summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2016-08-08 15:37:10 +0100
committerMiklos Vajna <vmiklos@collabora.co.uk>2016-08-09 12:29:34 +0000
commit11aa7278659d5f56288df620978107947aec4adc (patch)
tree628e31cdb6176f8b60bd7aa56a5c2410f5641e47
parentb7cb7443631d649d5d93957e4bd9685444157412 (diff)
Resolves: tdf#101359 getBookmarksCount includes more than aTableBookmarks
aTableBookmarks is just "BOOKMARK"s while getBookmarksCount() includes two extra types. So cache the result of getBookmarksCount when filling aTableBookmarks to compare if the count from the time of filling aTableBookmarks is unchanged. Change-Id: I69fedab613f23e4e2b30498e4620a370d92272e0 (cherry picked from commit cdb708291b59ac89b43c24154f0edc77f237eadd) Reviewed-on: https://gerrit.libreoffice.org/27992 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
-rw-r--r--sw/source/ui/misc/bookmark.cxx12
-rw-r--r--sw/source/uibase/inc/bookmark.hxx1
2 files changed, 8 insertions, 5 deletions
diff --git a/sw/source/ui/misc/bookmark.cxx b/sw/source/ui/misc/bookmark.cxx
index 1ab72f89b660..6798738750cb 100644
--- a/sw/source/ui/misc/bookmark.cxx
+++ b/sw/source/ui/misc/bookmark.cxx
@@ -246,7 +246,7 @@ bool SwInsertBookmarkDlg::ValidateBookmarks()
bool SwInsertBookmarkDlg::HaveBookmarksChanged()
{
IDocumentMarkAccess* const pMarkAccess = rSh.getIDocumentMarkAccess();
- if (pMarkAccess->getBookmarksCount() != static_cast<sal_Int32>(aTableBookmarks.size()))
+ if (pMarkAccess->getBookmarksCount() != m_nLastBookmarksCount)
return true;
IDocumentMarkAccess::const_iterator_t ppBookmark = pMarkAccess->getBookmarksBegin();
@@ -277,16 +277,18 @@ void SwInsertBookmarkDlg::PopulateTable()
aTableBookmarks.push_back(std::make_pair(ppBookmark->get(), ppBookmark->get()->GetName()));
}
}
+ m_nLastBookmarksCount = pMarkAccess->getBookmarksCount();
}
void SwInsertBookmarkDlg::Apply()
{
}
-SwInsertBookmarkDlg::SwInsertBookmarkDlg(vcl::Window* pParent, SwWrtShell& rS, SfxRequest& rRequest) :
- SvxStandardDialog(pParent, "InsertBookmarkDialog", "modules/swriter/ui/insertbookmark.ui"),
- rSh(rS),
- rReq(rRequest)
+SwInsertBookmarkDlg::SwInsertBookmarkDlg(vcl::Window* pParent, SwWrtShell& rS, SfxRequest& rRequest)
+ : SvxStandardDialog(pParent, "InsertBookmarkDialog", "modules/swriter/ui/insertbookmark.ui")
+ , rSh(rS)
+ , rReq(rRequest)
+ , m_nLastBookmarksCount(0)
{
get(m_pBookmarksContainer, "bookmarks");
get(m_pEditBox, "name");
diff --git a/sw/source/uibase/inc/bookmark.hxx b/sw/source/uibase/inc/bookmark.hxx
index 0754f6988bac..472cedb2bb64 100644
--- a/sw/source/uibase/inc/bookmark.hxx
+++ b/sw/source/uibase/inc/bookmark.hxx
@@ -61,6 +61,7 @@ class SwInsertBookmarkDlg: public SvxStandardDialog
SwWrtShell& rSh;
SfxRequest& rReq;
std::vector<std::pair<sw::mark::IMark*, OUString>> aTableBookmarks;
+ sal_Int32 m_nLastBookmarksCount;
DECL_LINK_TYPED(ModifyHdl, Edit&, void);
DECL_LINK_TYPED(InsertHdl, Button*, void);