diff options
author | Caolán McNamara <caolanm@redhat.com> | 2014-04-11 14:45:39 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2014-04-11 14:47:50 +0100 |
commit | e12184393f0591b5c5d9218062cc0a4bced6d4e6 (patch) | |
tree | b3149c8b9a1bdfbf18970697447ac183a27b7340 | |
parent | 56deaabb32346e0cc9c6946d7d53ba251f4450b2 (diff) |
Resolves: rhbz#1081176: don't jump to cursor pos when...
launching a new window view of a document. This was happening because of
(temporary) activation of the modified flag (from updating the document stats
in the bottom bar) triggering a scrolll to the current cursor position of the
old document
Change-Id: I6e1a3c07b66ff6373345850d1449f17c1f0baa17
-rw-r--r-- | sw/source/core/doc/doc.cxx | 40 |
1 files changed, 39 insertions, 1 deletions
diff --git a/sw/source/core/doc/doc.cxx b/sw/source/core/doc/doc.cxx index ed1e6ac65ffa..cd046dfba8b9 100644 --- a/sw/source/core/doc/doc.cxx +++ b/sw/source/core/doc/doc.cxx @@ -1653,6 +1653,41 @@ void SwDoc::CalculatePagePairsForProspectPrinting( // thus we are done here. } +namespace +{ + class LockAllViews + { + std::stack<bool> m_aViewWasLocked; + SwViewShell* m_pViewShell; + public: + LockAllViews(SwViewShell *pViewShell) + : m_pViewShell(pViewShell) + { + if (!m_pViewShell) + return; + SwViewShell *pSh = m_pViewShell; + do + { + m_aViewWasLocked.push(pSh->IsViewLocked()); + pSh->LockView(true); + pSh = (SwViewShell*)pSh->GetNext(); + } while (pSh != m_pViewShell); + } + ~LockAllViews() + { + if (!m_pViewShell) + return; + SwViewShell *pSh = m_pViewShell; + do + { + pSh->LockView(m_aViewWasLocked.top()); + m_aViewWasLocked.pop(); + pSh = (SwViewShell*)pSh->GetNext(); + } while (pSh != m_pViewShell); + } + }; +} + // returns true while there is more to do bool SwDoc::IncrementalDocStatCalculate(long nChars, bool bFields) { @@ -1723,7 +1758,7 @@ bool SwDoc::IncrementalDocStatCalculate(long nChars, bool bFields) aStat[n++].Value <<= (sal_Int32)mpDocStat->nCharExcludingSpaces; // For e.g. autotext documents there is no pSwgInfo (#i79945) - SfxObjectShell * const pObjShell( GetDocShell() ); + SwDocShell* pObjShell(GetDocShell()); if (pObjShell) { const uno::Reference<document::XDocumentPropertiesSupplier> xDPS( @@ -1733,6 +1768,9 @@ bool SwDoc::IncrementalDocStatCalculate(long nChars, bool bFields) // #i96786#: do not set modified flag when updating statistics const bool bDocWasModified( IsModified() ); const ModifyBlocker_Impl b(pObjShell); + // rhbz#1081176: don't jump to cursor pos because of (temporary) + // activation of modified flag triggering move to input position + LockAllViews aViewGuard((SwViewShell*)pObjShell->GetWrtShell()); xDocProps->setDocumentStatistics(aStat); if (!bDocWasModified) { |