summaryrefslogtreecommitdiff
path: root/sd
diff options
context:
space:
mode:
authorAshod Nakashian <ashod.nakashian@collabora.co.uk>2020-08-02 14:52:02 -0400
committerAshod Nakashian <ash@collabora.com>2020-08-11 17:34:47 +0200
commit4fd2679a7a2b0494da84f344ab97b835edf73377 (patch)
tree3c4c043664fbee79758870d270e458b6d378ab0a /sd
parent95ba7d3eb0a1d78958d43573d73669935364f481 (diff)
sfx2: lok: reliably support multi-documents
Instead of using the current view to set the DocId, we instead make sure that the ShellView object has the DocId set at construction time. This turned out to be necessary in at least one case (which has a unit-test that failed), which is when events fired during the creation of a new view. The cursor position is notified before we have a chance to set the DocId and because of that we miss the notifications (or worse, we end up sending them to all other documents' views in an effort to fix this bug). This approach is clean and always guarantees that all views have the correct DocId set as soon as possible and that all notifications are sent as expected. A unit-test is added to exercise mult-document usage, which exposed a number of bugs and issues that have been addressed in this patch. Change-Id: Icf5145fb1dabd0d029368310c2b9bf73ae927ccc Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99975 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-by: Michael Meeks <michael.meeks@collabora.com> Reviewed-by: Ashod Nakashian <ash@collabora.com>
Diffstat (limited to 'sd')
-rw-r--r--sd/qa/unit/tiledrendering/LOKitSearchTest.cxx1
-rw-r--r--sd/source/ui/unoidl/unomodel.cxx3
2 files changed, 4 insertions, 0 deletions
diff --git a/sd/qa/unit/tiledrendering/LOKitSearchTest.cxx b/sd/qa/unit/tiledrendering/LOKitSearchTest.cxx
index ac2695441575..fa5a875573fb 100644
--- a/sd/qa/unit/tiledrendering/LOKitSearchTest.cxx
+++ b/sd/qa/unit/tiledrendering/LOKitSearchTest.cxx
@@ -23,6 +23,7 @@
#include <comphelper/string.hxx>
#include <comphelper/lok.hxx>
#include <sfx2/dispatch.hxx>
+#include <sfx2/lokhelper.hxx>
#include <sfx2/viewfrm.hxx>
#include <svl/srchitem.hxx>
#include <svl/stritem.hxx>
diff --git a/sd/source/ui/unoidl/unomodel.cxx b/sd/source/ui/unoidl/unomodel.cxx
index cea0b9f4c420..f02868f0ca83 100644
--- a/sd/source/ui/unoidl/unomodel.cxx
+++ b/sd/source/ui/unoidl/unomodel.cxx
@@ -2296,6 +2296,9 @@ int SdXImpressDocument::getParts()
{
// TODO: master pages?
// Read: drviews1.cxx
+ if (!mpDoc)
+ return 0;
+
return mpDoc->GetSdPageCount(PageKind::Standard);
}