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 15:09:17 +0000
commita411bf38da3668094698c06c8424aa9d68c85702 (patch)
tree240aee3bcca959c7d9571b1efd40e6021d814237
parent96e7225260aac0815643a4043f4ddb4e6b5764a1 (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>
-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 6097b70c2b59..645c196cf89b 100644
--- a/sfx2/source/doc/templatedlg.cxx
+++ b/sfx2/source/doc/templatedlg.cxx
@@ -981,7 +981,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);
@@ -1152,6 +1152,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 )
@@ -1161,8 +1166,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)
{
@@ -1183,7 +1186,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)
@@ -1237,6 +1239,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 )
@@ -1245,7 +1252,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)
{
@@ -1280,6 +1286,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())
@@ -1319,7 +1329,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);