summaryrefslogtreecommitdiff
path: root/desktop/source/lib/init.cxx
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2016-09-14 19:47:47 +0200
committerMiklos Vajna <vmiklos@collabora.co.uk>2016-09-14 19:48:58 +0200
commit106cd072747a48ba064d8522cc15f581abffab51 (patch)
tree680854bb5b3af38476cd24bdc9f3cff2a318207f /desktop/source/lib/init.cxx
parent80fc0074689d657fbbf479da534f782bb9cc3cca (diff)
desktop lok: avoid unnecessary setPart() in paintPartTile()cp-5.1-6
If possible, switch views, not parts, that way started Impress text edits don't end as a side-effect. Change-Id: I3f18d4dda6bc24235bf1219416f153248a867fa4 (cherry picked from commit bee4ff508a456a1552aacdf6fc838b8b7cffb9ec)
Diffstat (limited to 'desktop/source/lib/init.cxx')
-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&)
{