[Libreoffice-commits] core.git: Branch 'libreoffice-5-2' - sw/inc sw/source

Caolán McNamara caolanm at redhat.com
Wed Dec 14 08:43:51 UTC 2016


 sw/inc/IDocumentState.hxx                    |    3 +++
 sw/source/core/doc/DocumentStateManager.cxx  |   14 ++++++++++++++
 sw/source/core/inc/DocumentStateManager.hxx  |    5 ++++-
 sw/source/core/layout/anchoreddrawobject.cxx |    7 ++++---
 4 files changed, 25 insertions(+), 4 deletions(-)

New commits:
commit 65a0d7a934aacd7cd17b97d5ec4b132f7195651f
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Tue Dec 6 15:17:38 2016 +0000

    Resolves: rhbz#1401082 gnome hangs opening a certain .docx
    
    this seems to be a problem since....
    
    commit 199eb08be994ef968eb38f4966bc27ef1756d382
    Author: Miklos Vajna <vmiklos at collabora.co.uk>
    Date:   Thu Jun 5 16:25:01 2014 +0200
    
        SwAnchoredDrawObject::GetObjBoundRect: avoid SwDoc::SetModified()
    
        This is a const method, but it does a const_cast to still resize an
        object... if that's so, then we should ensure that the "is modified"
        flag of SwDoc is untouched.
    
        CppunitTest_sw_ooxmlimport's testChartSize is a reproducer for this,
        when shape text is imported as textbox.
    
    (note under gtk3 and wayland this isn't as noticable, there use
    export GDK_BACKEND=x11 to reproduce the freeze effect where even
    the mouse cursor doesn't move during part of the load)
    
    Change-Id: Ic0bd98b032dfe1255d79d8070d50f65fcfa676dd
    Reviewed-on: https://gerrit.libreoffice.org/31687
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>
    (cherry picked from commit d393039655edf9bb884fc2956674badde59d2326)
    Reviewed-on: https://gerrit.libreoffice.org/31949

diff --git a/sw/inc/IDocumentState.hxx b/sw/inc/IDocumentState.hxx
index 6c4ecaa..eeab2ef 100644
--- a/sw/inc/IDocumentState.hxx
+++ b/sw/inc/IDocumentState.hxx
@@ -49,6 +49,9 @@ public:
 
     virtual void SetLoaded() = 0;
 
+    virtual bool IsEnableSetModified() const = 0;
+    virtual void SetEnableSetModified(bool bEnableSetModified) = 0;
+
 protected:
     virtual ~IDocumentState() {};
 };
diff --git a/sw/source/core/doc/DocumentStateManager.cxx b/sw/source/core/doc/DocumentStateManager.cxx
index 7b371d1..04a865a 100644
--- a/sw/source/core/doc/DocumentStateManager.cxx
+++ b/sw/source/core/doc/DocumentStateManager.cxx
@@ -29,6 +29,7 @@ namespace sw
 
 DocumentStateManager::DocumentStateManager( SwDoc& i_rSwdoc ) :
     m_rDoc( i_rSwdoc ),
+    mbEnableSetModified(true),
     mbModified(false),
     mbLoaded(false),
     mbUpdateExpField(false),
@@ -39,6 +40,9 @@ DocumentStateManager::DocumentStateManager( SwDoc& i_rSwdoc ) :
 
 void DocumentStateManager::SetModified()
 {
+    if (!IsEnableSetModified())
+        return;
+
     m_rDoc.GetDocumentLayoutManager().ClearSwLayouterEntries();
     mbModified = true;
     m_rDoc.GetDocumentStatisticsManager().SetDocStatModified( true );
@@ -75,6 +79,16 @@ bool DocumentStateManager::IsModified() const
     return mbModified;
 }
 
+bool DocumentStateManager::IsEnableSetModified() const
+{
+    return mbEnableSetModified;
+}
+
+void DocumentStateManager::SetEnableSetModified(bool bEnableSetModified)
+{
+    mbEnableSetModified = bEnableSetModified;
+}
+
 bool DocumentStateManager::IsInCallModified() const
 {
     return mbInCallModified;
diff --git a/sw/source/core/inc/DocumentStateManager.hxx b/sw/source/core/inc/DocumentStateManager.hxx
index 99b6a86..e79f94b 100644
--- a/sw/source/core/inc/DocumentStateManager.hxx
+++ b/sw/source/core/inc/DocumentStateManager.hxx
@@ -36,6 +36,8 @@ public:
     void SetModified() override;
     void ResetModified() override;
     bool IsModified() const override;
+    bool IsEnableSetModified() const override;
+    void SetEnableSetModified(bool bEnableSetModified) override;
     bool IsInCallModified() const override;
     bool IsUpdateExpField() const override;
     bool IsNewDoc() const override;
@@ -50,9 +52,10 @@ private:
 
     SwDoc& m_rDoc;
 
+    bool mbEnableSetModified; //< FALSE: changing document modification status (temporarily) locked
     bool mbModified      ;    //< TRUE: document has changed.
     bool mbLoaded        ;    //< TRUE: Doc loaded.
-    bool mbUpdateExpField  ;    //< TRUE: Update expression fields.
+    bool mbUpdateExpField;    //< TRUE: Update expression fields.
     bool mbNewDoc        ;    //< TRUE: new Doc.
     bool mbInCallModified;    //< TRUE: in Set/Reset-Modified link.
 };
diff --git a/sw/source/core/layout/anchoreddrawobject.cxx b/sw/source/core/layout/anchoreddrawobject.cxx
index 9b2a7e1..9010117 100644
--- a/sw/source/core/layout/anchoreddrawobject.cxx
+++ b/sw/source/core/layout/anchoreddrawobject.cxx
@@ -658,12 +658,13 @@ const SwRect SwAnchoredDrawObject::GetObjBoundRect() const
         if ( nTargetWidth != aCurrObjRect.GetWidth( ) || nTargetHeight != aCurrObjRect.GetHeight( ) )
         {
             SwDoc* pDoc = const_cast<SwDoc*>(GetPageFrame()->GetFormat()->GetDoc());
-            bool bModified = pDoc->getIDocumentState().IsModified();
+
+            bool bEnableSetModified = pDoc->getIDocumentState().IsEnableSetModified();
+            pDoc->getIDocumentState().SetEnableSetModified(false);
             const_cast< SdrObject* >( GetDrawObj() )->Resize( aCurrObjRect.TopLeft(),
                     Fraction( nTargetWidth, aCurrObjRect.GetWidth() ),
                     Fraction( nTargetHeight, aCurrObjRect.GetHeight() ), false );
-            if (!bModified)
-                pDoc->getIDocumentState().ResetModified();
+            pDoc->getIDocumentState().SetEnableSetModified(bEnableSetModified);
         }
     }
     return GetDrawObj()->GetCurrentBoundRect();


More information about the Libreoffice-commits mailing list