summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2016-12-06 15:17:38 +0000
committerMiklos Vajna <vmiklos@collabora.co.uk>2016-12-14 08:43:15 +0000
commit65a0d7a934aacd7cd17b97d5ec4b132f7195651f (patch)
tree36733419eab71522a0499a803d7d7cc91b70c87d /sw
parent24aecb12dd8a1050b0590cadf3d9ed41a2c23fc8 (diff)
Resolves: rhbz#1401082 gnome hangs opening a certain .docx
this seems to be a problem since.... commit 199eb08be994ef968eb38f4966bc27ef1756d382 Author: Miklos Vajna <vmiklos@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@libreoffice.org> Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk> (cherry picked from commit d393039655edf9bb884fc2956674badde59d2326) Reviewed-on: https://gerrit.libreoffice.org/31949
Diffstat (limited to 'sw')
-rw-r--r--sw/inc/IDocumentState.hxx3
-rw-r--r--sw/source/core/doc/DocumentStateManager.cxx14
-rw-r--r--sw/source/core/inc/DocumentStateManager.hxx5
-rw-r--r--sw/source/core/layout/anchoreddrawobject.cxx7
4 files changed, 25 insertions, 4 deletions
diff --git a/sw/inc/IDocumentState.hxx b/sw/inc/IDocumentState.hxx
index 6c4ecaabaa57..eeab2efa9e1d 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 7b371d172ef5..04a865a3f70b 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 99b6a86385c8..e79f94b042a4 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 9b2a7e123dc2..90101172d586 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();