[Libreoffice-commits] .: 12 commits - officecfg/registry sfx2/inc sfx2/source
Rafael Dominguez
rdominguez at kemper.freedesktop.org
Wed Aug 8 07:55:00 PDT 2012
officecfg/registry/data/org/openoffice/Office/Common.xcu | 6 +
officecfg/registry/schema/org/openoffice/Office/Common.xcs | 10 ++
sfx2/inc/sfx2/sfxsids.hrc | 5 -
sfx2/inc/sfx2/templateabstractview.hxx | 2
sfx2/inc/sfx2/templatelocalview.hxx | 2
sfx2/inc/sfx2/templateonlineview.hxx | 8 +
sfx2/inc/templatedlg.hxx | 1
sfx2/source/control/templatelocalview.cxx | 24 +++++
sfx2/source/control/templateonlineview.cxx | 62 +++++++++++--
sfx2/source/control/templateviewitem.cxx | 7 +
sfx2/source/doc/templatedlg.cxx | 31 +++++-
sfx2/source/doc/templatedlg.hrc | 8 -
sfx2/source/doc/templatedlg.src | 14 ++
13 files changed, 159 insertions(+), 21 deletions(-)
New commits:
commit 848e9fe2740d6192d98a4b966a3c3304c1cd6403
Author: Rafael Dominguez <venccsralph at gmail.com>
Date: Wed Aug 8 09:40:47 2012 -0430
Remove unused defines.
Change-Id: Ib6bf41ba5165399b9bb73783bce736eba8210c32
diff --git a/sfx2/source/doc/templatedlg.hrc b/sfx2/source/doc/templatedlg.hrc
index e7e29d7..3336090 100644
--- a/sfx2/source/doc/templatedlg.hrc
+++ b/sfx2/source/doc/templatedlg.hrc
@@ -52,10 +52,5 @@
#define MNI_REPOSITORY_NEW 275
#define MNI_REPOSITORY_BASE 276
-#define IMG_ONLINE_REPOSITORY 100
-#define IMG_CREATE_TEXT 300
-#define IMG_CREATE_SHEET 301
-#define IMG_CREATE_PRESENT 302
-#define IMG_CREATE_DRAW 303
#define IMG_ACTION_SORT 304
#define IMG_ACTION_REFRESH 305
commit 1d3ec03fdcf049788e0f3b81d60fecad6f34ee25
Author: Rafael Dominguez <venccsralph at gmail.com>
Date: Wed Aug 8 09:39:27 2012 -0430
Delete currently open remote overlay.
Change-Id: Iaf25b4110b41c3404a141d70342a59ef05d05ceb
diff --git a/sfx2/inc/sfx2/templateonlineview.hxx b/sfx2/inc/sfx2/templateonlineview.hxx
index 36d9f1b..aed70d2 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 ffbfc31..8991791 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 a3428f4..9828489 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 c029fc8..1e80c28 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();
commit 5bb9e2f5bb136d8c5844584e3203e8245094d409
Author: Rafael Dominguez <venccsralph at gmail.com>
Date: Wed Aug 8 08:09:54 2012 -0430
Display delete option when viewing a remote repository.
Change-Id: I63e6a0e2ef9a18144d97629ddf18bd91ecc0e115
diff --git a/sfx2/source/doc/templatedlg.cxx b/sfx2/source/doc/templatedlg.cxx
index 9c3c1c2..c029fc8 100644
--- a/sfx2/source/doc/templatedlg.cxx
+++ b/sfx2/source/doc/templatedlg.cxx
@@ -921,6 +921,8 @@ void SfxTemplateManagerDlg::switchMainView(bool bDisplayLocal)
{
mpCurView = maView;
+ mpViewBar->HideItem(TBI_TEMPLATE_FOLDER_DEL);
+
// Enable deleting items from the filesystem
mpTemplateBar->ShowItem(TBI_TEMPLATE_DELETE);
@@ -931,6 +933,8 @@ void SfxTemplateManagerDlg::switchMainView(bool bDisplayLocal)
{
mpCurView = mpOnlineView;
+ mpViewBar->ShowItem(TBI_TEMPLATE_FOLDER_DEL);
+
// Disable deleting items from remote repositories
mpTemplateBar->HideItem(TBI_TEMPLATE_DELETE);
commit 484aba1a6ed88bae9102dcf758e1499fb9ead0b1
Author: Rafael Dominguez <venccsralph at gmail.com>
Date: Wed Aug 8 07:50:20 2012 -0430
Make import contextual, appears when you select a folder to import to.
Change-Id: Ic935728cabf70c0700a35c65d3b5b060e163faea
diff --git a/sfx2/source/doc/templatedlg.cxx b/sfx2/source/doc/templatedlg.cxx
index 007d43f..9c3c1c2 100644
--- a/sfx2/source/doc/templatedlg.cxx
+++ b/sfx2/source/doc/templatedlg.cxx
@@ -147,7 +147,6 @@ SfxTemplateManagerDlg::SfxTemplateManagerDlg (Window *parent)
mpTemplateBar->SetButtonType(BUTTON_SYMBOLTEXT);
// Set toolbox button bits
- mpViewBar->EnableItem(TBI_TEMPLATE_IMPORT,false);
mpViewBar->SetItemBits(TBI_TEMPLATE_REPOSITORY, TIB_DROPDOWNONLY);
mpActionBar->SetItemBits(TBI_TEMPLATE_ACTION, TIB_DROPDOWNONLY);
mpTemplateBar->SetItemBits(TBI_TEMPLATE_MOVE,TIB_DROPDOWNONLY);
@@ -452,7 +451,7 @@ IMPL_LINK(SfxTemplateManagerDlg, TVFolderStateHdl, const ThumbnailViewItem*, pIt
{
if (maSelFolders.empty())
{
- mpViewBar->EnableItem(TBI_TEMPLATE_IMPORT,true);
+ mpViewBar->ShowItem(TBI_TEMPLATE_IMPORT);
mpViewBar->ShowItem(TBI_TEMPLATE_FOLDER_DEL);
}
@@ -464,7 +463,7 @@ IMPL_LINK(SfxTemplateManagerDlg, TVFolderStateHdl, const ThumbnailViewItem*, pIt
if (maSelFolders.empty())
{
- mpViewBar->EnableItem(TBI_TEMPLATE_IMPORT,false);
+ mpViewBar->HideItem(TBI_TEMPLATE_IMPORT);
mpViewBar->HideItem(TBI_TEMPLATE_FOLDER_DEL);
}
}
@@ -866,7 +865,7 @@ void SfxTemplateManagerDlg::OnFolderDelete()
if (maSelFolders.empty())
{
- mpViewBar->EnableItem(TBI_TEMPLATE_IMPORT,false);
+ mpViewBar->HideItem(TBI_TEMPLATE_IMPORT);
mpViewBar->HideItem(TBI_TEMPLATE_FOLDER_DEL);
}
}
diff --git a/sfx2/source/doc/templatedlg.src b/sfx2/source/doc/templatedlg.src
index 98c17ac..c5d54d3 100644
--- a/sfx2/source/doc/templatedlg.src
+++ b/sfx2/source/doc/templatedlg.src
@@ -154,6 +154,7 @@ ModelessDialog DLG_TEMPLATE_MANAGER
ToolBoxItem
{
Identifier = TBI_TEMPLATE_IMPORT ;
+ Hide = TRUE;
Text [ en-US ] = "Import" ;
ItemImage = Image
commit 444df12235edf280f783ed06a3c4c05e1ea0dd92
Author: Rafael Dominguez <venccsralph at gmail.com>
Date: Wed Aug 8 07:33:02 2012 -0430
Store template repositories urls and names in user settings.
Change-Id: I8fea48ede99e3a5568ac248b7dddc8475fae4280
diff --git a/officecfg/registry/data/org/openoffice/Office/Common.xcu b/officecfg/registry/data/org/openoffice/Office/Common.xcu
index ad1b88f..45e8b35 100644
--- a/officecfg/registry/data/org/openoffice/Office/Common.xcu
+++ b/officecfg/registry/data/org/openoffice/Office/Common.xcu
@@ -590,6 +590,12 @@
<value oor:external=
"com.sun.star.configuration.backend.GconfBackend SymbolSet"/>
</prop>
+ <prop oor:name="TemplateRepositoryUrls">
+ <value/>
+ </prop>
+ <prop oor:name="TemplateRepositoryNames">
+ <value/>
+ </prop>
<prop oor:name="FilePickerPlacesUrls">
<value/>
</prop>
diff --git a/officecfg/registry/schema/org/openoffice/Office/Common.xcs b/officecfg/registry/schema/org/openoffice/Office/Common.xcs
index a0d672b..2c27fdf 100644
--- a/officecfg/registry/schema/org/openoffice/Office/Common.xcs
+++ b/officecfg/registry/schema/org/openoffice/Office/Common.xcs
@@ -6767,6 +6767,16 @@
</info>
<value>true</value>
</prop>
+ <prop oor:name="TemplateRepositoryUrls" oor:type="oor:string-list" oor:nillable="false">
+ <info>
+ <desc>List of template repositories URLs bookmarked in the template manager dialog.</desc>
+ </info>
+ </prop>
+ <prop oor:name="TemplateRepositoryNames" oor:type="oor:string-list" oor:nillable="false">
+ <info>
+ <desc>List of template repositories names bookmarked in the template manager dialog.</desc>
+ </info>
+ </prop>
<prop oor:name="FilePickerPlacesUrls" oor:type="oor:string-list" oor:nillable="false">
<info>
<desc>List of URLs of the places the user bookmarked in the file picker dialog.</desc>
diff --git a/sfx2/source/control/templateonlineview.cxx b/sfx2/source/control/templateonlineview.cxx
index 8ee9fc5..a3428f4 100644
--- a/sfx2/source/control/templateonlineview.cxx
+++ b/sfx2/source/control/templateonlineview.cxx
@@ -77,10 +77,10 @@ void TemplateOnlineView::Populate()
// Load from user settings
com::sun::star::uno::Sequence< rtl::OUString > aUrls =
- officecfg::Office::Common::Misc::FilePickerPlacesUrls::get(m_context);
+ officecfg::Office::Common::Misc::TemplateRepositoryUrls::get(m_context);
com::sun::star::uno::Sequence< rtl::OUString > aNames =
- officecfg::Office::Common::Misc::FilePickerPlacesNames::get(m_context);
+ officecfg::Office::Common::Misc::TemplateRepositoryNames::get(m_context);
for (sal_Int32 i = 0; i < aUrls.getLength() && i < aNames.getLength(); ++i)
{
@@ -284,8 +284,8 @@ void TemplateOnlineView::syncRepositories() const
aNames[i] = maRepositories[i]->maTitle;
}
- officecfg::Office::Common::Misc::FilePickerPlacesUrls::set(aUrls, batch, pContext);
- officecfg::Office::Common::Misc::FilePickerPlacesNames::set(aNames, batch, pContext);
+ officecfg::Office::Common::Misc::TemplateRepositoryUrls::set(aUrls, batch, pContext);
+ officecfg::Office::Common::Misc::TemplateRepositoryNames::set(aNames, batch, pContext);
batch->commit();
}
}
commit 107ee398701e543bcf3045a1cda4128e2b3b63c7
Author: Rafael Dominguez <venccsralph at gmail.com>
Date: Tue Aug 7 21:17:38 2012 -0430
Set overlay title and id when loading a remote repository.
Change-Id: I403f2615d05475281ef653a68f1f6cbc6fc9ccf1
diff --git a/sfx2/source/control/templateonlineview.cxx b/sfx2/source/control/templateonlineview.cxx
index e1a83f2..8ee9fc5 100644
--- a/sfx2/source/control/templateonlineview.cxx
+++ b/sfx2/source/control/templateonlineview.cxx
@@ -140,6 +140,10 @@ bool TemplateOnlineView::loadRepository (const sal_uInt16 nRepositoryId, bool bR
return true;
}
+ mpItemView->Clear();
+ mpItemView->setId(nRepositoryId);
+ mpItemView->setName(pItem->maTitle);
+
rtl::OUString aURL = static_cast<TemplateOnlineViewItem*>(pItem)->getURL();
try
@@ -170,8 +174,6 @@ bool TemplateOnlineView::loadRepository (const sal_uInt16 nRepositoryId, bool bR
if ( xResultSet.is() )
{
pItem->clearTemplates();
- mpItemView->Clear();
- mpItemView->setId(nRepositoryId);
uno::Reference< XRow > xRow( xResultSet, UNO_QUERY );
uno::Reference< XContentAccess > xContentAccess( xResultSet, UNO_QUERY );
@@ -236,7 +238,6 @@ bool TemplateOnlineView::loadRepository (const sal_uInt16 nRepositoryId, bool bR
}
}
- mpItemView->setName(pItem->maTitle);
mpItemView->InsertItems(aItems);
}
}
commit 730ae09563d4688e4e7c3a3a8988c5941017df14
Author: Rafael Dominguez <venccsralph at gmail.com>
Date: Tue Aug 7 21:08:13 2012 -0430
Insert cached items to overlay instead of displaying current ones.
Change-Id: Ib1c15664901a2696c632ba954eef3b37d157ed50
diff --git a/sfx2/source/control/templateonlineview.cxx b/sfx2/source/control/templateonlineview.cxx
index 1c64d26..e1a83f2 100644
--- a/sfx2/source/control/templateonlineview.cxx
+++ b/sfx2/source/control/templateonlineview.cxx
@@ -135,7 +135,10 @@ bool TemplateOnlineView::loadRepository (const sal_uInt16 nRepositoryId, bool bR
return false;
if (!pItem->getTemplates().empty() && !bRefresh)
+ {
+ mpItemView->InsertItems(pItem->getTemplates());
return true;
+ }
rtl::OUString aURL = static_cast<TemplateOnlineViewItem*>(pItem)->getURL();
commit fb5a7e213571caafb83fdec9d5cdfb6f5ad7c4f7
Author: Rafael Dominguez <venccsralph at gmail.com>
Date: Tue Aug 7 19:01:59 2012 -0430
Update remote repository name.
- Check that theres no name clash with other repositories.
Change-Id: I66de40d17bc2d593e1ea4697320a7abe0a397718
diff --git a/sfx2/inc/sfx2/templateonlineview.hxx b/sfx2/inc/sfx2/templateonlineview.hxx
index abb2819..36d9f1b 100644
--- a/sfx2/inc/sfx2/templateonlineview.hxx
+++ b/sfx2/inc/sfx2/templateonlineview.hxx
@@ -46,6 +46,10 @@ public:
private:
+ DECL_LINK(ChangeNameHdl, TemplateView*);
+
+private:
+
bool mbIsSynced;
std::vector<TemplateOnlineViewItem*> maRepositories;
com::sun::star::uno::Reference< com::sun::star::ucb::XCommandEnvironment > m_xCmdEnv;
diff --git a/sfx2/source/control/templateonlineview.cxx b/sfx2/source/control/templateonlineview.cxx
index 36865eb..1c64d26 100644
--- a/sfx2/source/control/templateonlineview.cxx
+++ b/sfx2/source/control/templateonlineview.cxx
@@ -56,6 +56,7 @@ TemplateOnlineView::TemplateOnlineView (Window *pParent, WinBits nWinStyle, bool
, mbIsSynced(true)
{
mpItemView->SetColor(Color(COL_WHITE));
+ mpItemView->setChangeNameHdl(LINK(this,TemplateOnlineView,ChangeNameHdl));
Reference< XMultiServiceFactory > xFactory = comphelper::getProcessServiceFactory();
Reference< XInteractionHandler > xGlobalInteractionHandler = Reference< XInteractionHandler >(
@@ -292,4 +293,23 @@ void TemplateOnlineView::setItemDimensions(long ItemWidth, long ThumbnailHeight,
mpItemView->setItemDimensions(ItemWidth,ThumbnailHeight,DisplayHeight,itemPadding);
}
+IMPL_LINK (TemplateOnlineView, ChangeNameHdl, TemplateView*, pView)
+{
+ bool bRet = true;
+ mbIsSynced = 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())
+ {
+ bRet = false;
+ mbIsSynced = true;
+ break;
+ }
+ }
+
+ return bRet;
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit 7ec0e8838a25adf0f228e94d75c635905989c872
Author: Rafael Dominguez <venccsralph at gmail.com>
Date: Tue Aug 7 18:07:51 2012 -0430
Scale down template thumbnail subtitle.
Change-Id: I6dea3ae4800a645ac6a187ff99c5fb10513043c8
diff --git a/sfx2/source/control/templateviewitem.cxx b/sfx2/source/control/templateviewitem.cxx
index 01041a9..4b559d3 100644
--- a/sfx2/source/control/templateviewitem.cxx
+++ b/sfx2/source/control/templateviewitem.cxx
@@ -19,6 +19,8 @@
#include <drawinglayer/processor2d/baseprocessor2d.hxx>
#include <vcl/button.hxx>
+#define SUBTITLE_SCALE_FACTOR 0.85
+
using namespace basegfx;
using namespace basegfx::tools;
using namespace drawinglayer::attribute;
@@ -52,7 +54,8 @@ void TemplateViewItem::calculateItemsPosition(sal_uInt32 nMaxTextLength)
// Set subtitle position
maSubTitlePos.setY(maTextPos.getY() + nSpace);
- maSubTitlePos.setX(maDrawArea.Left() + (aRectSize.Width() - aTextDev.getTextWidth(maSubTitle,0,nMaxTextLength))/2);
+ maSubTitlePos.setX(maDrawArea.Left() +
+ (aRectSize.Width() - aTextDev.getTextWidth(maSubTitle,0,nMaxTextLength)*SUBTITLE_SCALE_FACTOR)/2);
}
}
@@ -101,7 +104,7 @@ void TemplateViewItem::Paint(drawinglayer::processor2d::BaseProcessor2D *pProces
if (!maSubTitle.isEmpty())
{
basegfx::B2DHomMatrix aSubTitleMatrix( createScaleTranslateB2DHomMatrix(
- pAttrs->aFontSize.getX(), pAttrs->aFontSize.getY(),
+ pAttrs->aFontSize.getX()*SUBTITLE_SCALE_FACTOR, pAttrs->aFontSize.getY()*SUBTITLE_SCALE_FACTOR,
double( maSubTitlePos.X() ), double( maSubTitlePos.Y() ) ) );
aSeq[3] = Primitive2DReference(
commit 91c50153889e32aa5ed796f082c594d9f17c9b31
Author: Rafael Dominguez <venccsralph at gmail.com>
Date: Tue Aug 7 16:37:03 2012 -0430
Fix conflicting sfx command ids.
Change-Id: I7063eb37976b13ba7e64d4b9aa44fdb4474e7278
diff --git a/sfx2/inc/sfx2/sfxsids.hrc b/sfx2/inc/sfx2/sfxsids.hrc
index 772b561..c2eadf7 100644
--- a/sfx2/inc/sfx2/sfxsids.hrc
+++ b/sfx2/inc/sfx2/sfxsids.hrc
@@ -275,8 +275,9 @@
#define SID_GOTOLINE (SID_SFX_START + 1724)
#define SID_SHOWLINES (SID_SFX_START + 1725)
#define SID_BLUETOOTH_SENDDOC (SID_SFX_START + 1726)
+#define SID_TEMPLATE_MANAGER (SID_SFX_START + 1727)
-// SID_SFX_free_START (SID_SFX_START + 1727)
+// SID_SFX_free_START (SID_SFX_START + 1728)
// SID_SFX_free_END (SID_SFX_START + 3999)
#define SID_OPEN_NEW_VIEW (SID_SFX_START + 520)
@@ -330,8 +331,6 @@
// Floating Window Template
#define SID_STYLE_DESIGNER (SID_SFX_START + 539)
-#define SID_TEMPLATE_MANAGER (SID_SFX_START + 1726)
-
// Organizer
#define SID_ORGANIZER (SID_SFX_START + 540)
#define SID_TEMPLATE_ADDRESSBOKSOURCE (SID_SFX_START + 1655)
commit ef71e97d8cae548a46a0040de68df35e5a300905
Author: Rafael Dominguez <venccsralph at gmail.com>
Date: Tue Aug 7 10:27:44 2012 -0430
Reload view templates when click refresh button.
- Force remote repository to fetch new template list and update cache.
Change-Id: I9d7d67d367023323ca43731d78a275d389a9cf15
diff --git a/sfx2/inc/sfx2/templateabstractview.hxx b/sfx2/inc/sfx2/templateabstractview.hxx
index 943b622..6a1adce 100644
--- a/sfx2/inc/sfx2/templateabstractview.hxx
+++ b/sfx2/inc/sfx2/templateabstractview.hxx
@@ -68,6 +68,8 @@ public:
// Fill view with template folders thumbnails
virtual void Populate () = 0;
+ virtual void reload () = 0;
+
virtual void filterTemplatesByApp (const FILTER_APPLICATION &eApp) = 0;
virtual void showOverlay (bool bVisible) = 0;
diff --git a/sfx2/inc/sfx2/templatelocalview.hxx b/sfx2/inc/sfx2/templatelocalview.hxx
index d0b22d5..7b5984b 100644
--- a/sfx2/inc/sfx2/templatelocalview.hxx
+++ b/sfx2/inc/sfx2/templatelocalview.hxx
@@ -29,6 +29,8 @@ public:
// Fill view with template folders thumbnails
virtual void Populate ();
+ virtual void reload ();
+
std::vector<rtl::OUString> getFolderNames ();
virtual void showOverlay (bool bVisible);
diff --git a/sfx2/inc/sfx2/templateonlineview.hxx b/sfx2/inc/sfx2/templateonlineview.hxx
index a37d762..abb2819 100644
--- a/sfx2/inc/sfx2/templateonlineview.hxx
+++ b/sfx2/inc/sfx2/templateonlineview.hxx
@@ -28,6 +28,8 @@ public:
// Load repositories from user settings.
virtual void Populate ();
+ virtual void reload ();
+
virtual void filterTemplatesByApp (const FILTER_APPLICATION &eApp);
virtual void showOverlay (bool bVisible);
diff --git a/sfx2/source/control/templatelocalview.cxx b/sfx2/source/control/templatelocalview.cxx
index 9fff6d2..a1dd938 100644
--- a/sfx2/source/control/templatelocalview.cxx
+++ b/sfx2/source/control/templatelocalview.cxx
@@ -174,6 +174,30 @@ void TemplateLocalView::Populate ()
Invalidate();
}
+void TemplateLocalView::reload ()
+{
+ mpDocTemplates->Update();
+
+ Clear();
+
+ Populate();
+
+ if (mpItemView->IsVisible())
+ {
+ sal_uInt16 nItemId = mpItemView->getId() + 1;
+
+ for (size_t i = 0; i < mItemList.size(); ++i)
+ {
+ if (mItemList[i]->mnId == nItemId)
+ {
+ mpItemView->Clear();
+ mpItemView->InsertItems(static_cast<TemplateLocalViewItem*>(mItemList[i])->maTemplates);
+ break;
+ }
+ }
+ }
+}
+
std::vector<rtl::OUString> TemplateLocalView::getFolderNames()
{
size_t n = mItemList.size();
diff --git a/sfx2/source/control/templateonlineview.cxx b/sfx2/source/control/templateonlineview.cxx
index 6a9b040..36865eb 100644
--- a/sfx2/source/control/templateonlineview.cxx
+++ b/sfx2/source/control/templateonlineview.cxx
@@ -93,6 +93,11 @@ void TemplateOnlineView::Populate()
}
}
+void TemplateOnlineView::reload ()
+{
+ loadRepository(mpItemView->getId(),true);
+}
+
void TemplateOnlineView::filterTemplatesByApp(const FILTER_APPLICATION &eApp)
{
if (mpItemView->IsVisible())
diff --git a/sfx2/source/doc/templatedlg.cxx b/sfx2/source/doc/templatedlg.cxx
index 5c1b666..007d43f 100644
--- a/sfx2/source/doc/templatedlg.cxx
+++ b/sfx2/source/doc/templatedlg.cxx
@@ -111,6 +111,7 @@ SfxTemplateManagerDlg::SfxTemplateManagerDlg (Window *parent)
// Create popup menus
mpActionMenu = new PopupMenu;
mpActionMenu->InsertItem(MNI_ACTION_SORT_NAME,SfxResId(STR_ACTION_SORT_NAME).toString(),SfxResId(IMG_ACTION_SORT));
+ mpActionMenu->InsertItem(MNI_ACTION_REFRESH,SfxResId(STR_ACTION_REFRESH).toString(),SfxResId(IMG_ACTION_REFRESH));
mpActionMenu->SetSelectHdl(LINK(this,SfxTemplateManagerDlg,MenuSelectHdl));
mpRepositoryMenu = new PopupMenu;
@@ -514,6 +515,9 @@ IMPL_LINK(SfxTemplateManagerDlg, MenuSelectHdl, Menu*, pMenu)
else
maView->sortItems(SortView_Name());
break;
+ case MNI_ACTION_REFRESH:
+ mpCurView->reload();
+ break;
default:
break;
}
diff --git a/sfx2/source/doc/templatedlg.hrc b/sfx2/source/doc/templatedlg.hrc
index 810d03d..e7e29d7 100644
--- a/sfx2/source/doc/templatedlg.hrc
+++ b/sfx2/source/doc/templatedlg.hrc
@@ -28,6 +28,7 @@
#define TBI_TEMPLATE_MOVE 17
#define TBI_TEMPLATE_DELETE 18
+#define MNI_ACTION_REFRESH 22
#define MNI_ACTION_SORT_NAME 23
#define BTN_TEMPLATE_CLOSE 24
@@ -35,6 +36,7 @@
#define TBI_TEMPLATE_FOLDER_DEL 25
#define TBI_TEMPLATE_REPOSITORY 26
+#define STR_ACTION_REFRESH 263
#define STR_ACTION_SORT_NAME 264
#define MNI_MOVE_NEW 265
@@ -56,3 +58,4 @@
#define IMG_CREATE_PRESENT 302
#define IMG_CREATE_DRAW 303
#define IMG_ACTION_SORT 304
+#define IMG_ACTION_REFRESH 305
diff --git a/sfx2/source/doc/templatedlg.src b/sfx2/source/doc/templatedlg.src
index d973e46..98c17ac 100644
--- a/sfx2/source/doc/templatedlg.src
+++ b/sfx2/source/doc/templatedlg.src
@@ -15,6 +15,11 @@ String STR_ACTION_SORT_NAME
Text [ en-US ] = "Sort by name";
};
+String STR_ACTION_REFRESH
+{
+ Text [ en-US ] = "Refresh";
+};
+
String STR_MOVE_NEW
{
Text [ en-US ] = "New folder";
@@ -123,6 +128,14 @@ ModelessDialog DLG_TEMPLATE_MANAGER
};
};
+ Image IMG_ACTION_REFRESH
+ {
+ ImageBitmap = Bitmap
+ {
+ File = "reload.png";
+ };
+ };
+
ToolBox TBX_ACTION_VIEW
{
commit 0817e7c0943e9f89db1cf58f50fcc81c6a302682
Author: Rafael Dominguez <venccsralph at gmail.com>
Date: Tue Aug 7 10:02:57 2012 -0430
Set overlay repository id.
Change-Id: Idc1cfccfc83e7252fefabf11ca925a12db075a14
diff --git a/sfx2/source/control/templateonlineview.cxx b/sfx2/source/control/templateonlineview.cxx
index bb085c6..6a9b040 100644
--- a/sfx2/source/control/templateonlineview.cxx
+++ b/sfx2/source/control/templateonlineview.cxx
@@ -162,6 +162,7 @@ bool TemplateOnlineView::loadRepository (const sal_uInt16 nRepositoryId, bool bR
{
pItem->clearTemplates();
mpItemView->Clear();
+ mpItemView->setId(nRepositoryId);
uno::Reference< XRow > xRow( xResultSet, UNO_QUERY );
uno::Reference< XContentAccess > xContentAccess( xResultSet, UNO_QUERY );
More information about the Libreoffice-commits
mailing list