Kaydet (Commit) d3930396 authored tarafından Caolán McNamara's avatar Caolán McNamara Kaydeden (comit) Miklos Vajna

Resolves: rhbz#1401082 gnome hangs opening a certain .docx

this seems to be a problem since....

commit 199eb08b
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/31687Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarMiklos Vajna <vmiklos@collabora.co.uk>
üst f212bd45
......@@ -49,6 +49,9 @@ public:
virtual void SetLoaded() = 0;
virtual bool IsEnableSetModified() const = 0;
virtual void SetEnableSetModified(bool bEnableSetModified) = 0;
protected:
virtual ~IDocumentState() {};
};
......
......@@ -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;
......
......@@ -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.
};
......
......@@ -660,12 +660,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();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment