summaryrefslogtreecommitdiff
path: root/desktop/source/lib
diff options
context:
space:
mode:
Diffstat (limited to 'desktop/source/lib')
-rw-r--r--desktop/source/lib/init.cxx24
1 files changed, 24 insertions, 0 deletions
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index f678d6944ac2..582c52ce9cee 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -1486,6 +1486,7 @@ void doc_paintPartTile(LibreOfficeKitDocument* pThis,
const int nTilePosX, const int nTilePosY,
const int nTileWidth, const int nTileHeight)
{
+ SolarMutexGuard aGuard;
SAL_INFO( "lok.tiledrendering", "paintPartTile: painting @ " << nPart << " ["
<< nTileWidth << "x" << nTileHeight << "]@("
<< nTilePosX << ", " << nTilePosY << ") to ["
@@ -1503,8 +1504,27 @@ void doc_paintPartTile(LibreOfficeKitDocument* pThis,
// Text documents have a single coordinate system; don't change part.
int nOrigPart = 0;
const bool isText = (doc_getDocumentType(pThis) == LOK_DOCTYPE_TEXT);
+ int nOrigViewId = doc_getView(pThis);
+ int nViewId = nOrigViewId;
if (!isText)
{
+ // Check if just switching to an other view is enough, that has
+ // less side-effects.
+ if (nPart != doc_getPart(pThis))
+ {
+ SfxViewShell* pViewShell = SfxViewShell::GetFirst();
+ while (pViewShell)
+ {
+ if (pViewShell->getPart() == nPart)
+ {
+ nViewId = pViewShell->GetViewShellId();
+ doc_setView(pThis, nViewId);
+ break;
+ }
+ pViewShell = SfxViewShell::GetNext(*pViewShell);
+ }
+ }
+
nOrigPart = doc_getPart(pThis);
if (nPart != nOrigPart)
{
@@ -1518,6 +1538,10 @@ void doc_paintPartTile(LibreOfficeKitDocument* pThis,
{
doc_setPart(pThis, nOrigPart);
}
+ if (!isText && nViewId != nOrigViewId)
+ {
+ doc_setView(pThis, nOrigViewId);
+ }
}
catch (const std::exception&)
{