summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoren De Cuyper <joren.libreoffice@telenet.be>2014-02-06 16:36:07 +0100
committerCaolán McNamara <caolanm@redhat.com>2014-02-07 20:15:11 +0000
commit57df90332e823d501744a87c8c94ad51ed5aead6 (patch)
tree8725a7192e0614b3f5cbc8403ec75df2fd10afa1
parentaf32163ce76cf1fb2087486f0dff03f3d45ab548 (diff)
fdo#74506 fdo#74291 -Template manager-store selection before calling dialog
It looks like calling a dialog/querybox result in a deselection of the selected ThumbnailViewItem(s). Therefore lets save this selection first, before calling such dialog. Change-Id: I45a1da4307759ca6472f793fff29b1e2507fd5c9 Reviewed-on: https://gerrit.libreoffice.org/7902 Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com> (cherry picked from commit a411bf38da3668094698c06c8424aa9d68c85702) Reviewed-on: https://gerrit.libreoffice.org/7925
-rw-r--r--sfx2/source/doc/templatedlg.cxx22
1 files changed, 16 insertions, 6 deletions
diff --git a/sfx2/source/doc/templatedlg.cxx b/sfx2/source/doc/templatedlg.cxx
index e2b81d554fa9..08608aa8b429 100644
--- a/sfx2/source/doc/templatedlg.cxx
+++ b/sfx2/source/doc/templatedlg.cxx
@@ -1079,7 +1079,7 @@ void SfxTemplateManagerDlg::OnTemplateExport()
{
sal_uInt16 i = 1;
- std::set<const ThumbnailViewItem*,selection_cmp_fn>::const_iterator pIter = maSelTemplates.begin();
+ std::set<const ThumbnailViewItem*,selection_cmp_fn>::const_iterator pIter;
for (pIter = maSelTemplates.begin(); pIter != maSelTemplates.end(); ++pIter, ++i)
{
const TemplateSearchViewItem *pItem = static_cast<const TemplateSearchViewItem*>(*pIter);
@@ -1268,6 +1268,11 @@ void SfxTemplateManagerDlg::OnTemplateProperties ()
void SfxTemplateManagerDlg::OnTemplateDelete ()
{
+ // Store selected templates before calling a dialog/QueryBox
+ // which will result in a deselection of all ThumbnailViewItem.
+ // Also avoid invalid iterators
+ std::set<const ThumbnailViewItem*,selection_cmp_fn> aSelTemplates = maSelTemplates;
+
QueryBox aQueryDlg(this, WB_YES_NO | WB_DEF_YES, SfxResId(STR_QMSG_SEL_TEMPLATE_DELETE).toString());
if ( aQueryDlg.Execute() == RET_NO )
@@ -1277,8 +1282,6 @@ void SfxTemplateManagerDlg::OnTemplateDelete ()
if (mpSearchView->IsVisible())
{
- std::set<const ThumbnailViewItem*,selection_cmp_fn> aSelTemplates = maSelTemplates; //Avoids invalid iterators
-
std::set<const ThumbnailViewItem*,selection_cmp_fn>::const_iterator pIter;
for (pIter = aSelTemplates.begin(); pIter != aSelTemplates.end(); ++pIter)
{
@@ -1299,7 +1302,6 @@ void SfxTemplateManagerDlg::OnTemplateDelete ()
else
{
sal_uInt16 nRegionItemId = mpLocalView->getCurRegionItemId();
- std::set<const ThumbnailViewItem*,selection_cmp_fn> aSelTemplates = maSelTemplates; //Avoid invalid iterators
std::set<const ThumbnailViewItem*,selection_cmp_fn>::const_iterator pIter;
for (pIter = aSelTemplates.begin(); pIter != aSelTemplates.end(); ++pIter)
@@ -1353,6 +1355,11 @@ void SfxTemplateManagerDlg::OnFolderNew()
void SfxTemplateManagerDlg::OnFolderDelete()
{
+ // Store selected folders before calling a dialog/QueryBox
+ // which will result in a deselection of all ThumbnailViewItem.
+ // Also copy to avoid invalidating an iterator
+ std::set<const ThumbnailViewItem*,selection_cmp_fn> aSelFolders = maSelFolders;
+
QueryBox aQueryDlg(this, WB_YES_NO | WB_DEF_YES, SfxResId(STR_QMSG_SEL_FOLDER_DELETE).toString());
if ( aQueryDlg.Execute() == RET_NO )
@@ -1361,7 +1368,6 @@ void SfxTemplateManagerDlg::OnFolderDelete()
OUString aFolderList;
std::set<const ThumbnailViewItem*,selection_cmp_fn>::const_iterator pIter;
- std::set<const ThumbnailViewItem*,selection_cmp_fn> aSelFolders = maSelFolders; //Copy to avoid invalidating an iterator
for (pIter = aSelFolders.begin(); pIter != aSelFolders.end(); ++pIter)
{
@@ -1396,6 +1402,10 @@ void SfxTemplateManagerDlg::OnRepositoryDelete()
void SfxTemplateManagerDlg::OnTemplateSaveAs()
{
+ // Store selected folders before calling a dialog/QueryBox
+ // which will result in a deselection of all ThumbnailViewItem
+ std::set<const ThumbnailViewItem*,selection_cmp_fn> aSelFolders = maSelFolders;
+
assert(m_xModel.is());
if (!mpLocalView->isNonRootRegionVisible() && maSelFolders.empty())
@@ -1435,7 +1445,7 @@ void SfxTemplateManagerDlg::OnTemplateSaveAs()
else
{
std::set<const ThumbnailViewItem*,selection_cmp_fn>::const_iterator pIter;
- for (pIter = maSelFolders.begin(); pIter != maSelFolders.end(); ++pIter)
+ for (pIter = aSelFolders.begin(); pIter != aSelFolders.end(); ++pIter)
{
TemplateContainerItem *pItem = (TemplateContainerItem*)(*pIter);