[Libreoffice-commits] core.git: sw/source
Caolán McNamara
caolanm at redhat.com
Mon Aug 8 14:42:47 UTC 2016
sw/source/ui/misc/bookmark.cxx | 12 +++++++-----
sw/source/uibase/inc/bookmark.hxx | 1 +
2 files changed, 8 insertions(+), 5 deletions(-)
New commits:
commit cdb708291b59ac89b43c24154f0edc77f237eadd
Author: Caolán McNamara <caolanm at redhat.com>
Date: Mon Aug 8 15:37:10 2016 +0100
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
diff --git a/sw/source/ui/misc/bookmark.cxx b/sw/source/ui/misc/bookmark.cxx
index 56734dc..5aeb462 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 0754f69..472cedb 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);
More information about the Libreoffice-commits
mailing list