Kaydet (Commit) 757f461e authored tarafından Caolán McNamara's avatar Caolán McNamara

avoid activating chart objects just to get their mapunit or set visual size

the motivation is SwWrtShell::CalcAndSetScale

and the assert/crash triggered by

ooo58458-1.odt ooo84729-2.odt ooo75058-1.odt ooo123605-1.odt ooo102990-1.odt
fdo57249-1.odt fdo50880-1.odt fdo70223-5.odt ooo30052-2.odt ooo119280-1.odt
ooo79009-1.odt ooo58182-2.odt ooo59992-1.odt ooo123607-1.odt ooo89304-1.odt
ooo91578-5.odt ooo89303-1.odt ooo30052-1.odt fdo65664-3.odt ooo119941-1.odt
ooo55761-1.odt fdo57249-2.odt ooo83229-3.odt ooo84729-1.odt ooo102990-2.odt
ooo37749-1.sxw ooo38798-1.sxw ooo27909-1.sxw

getMapUnit activates the object which can cause chart object to load data from
the current document and appears to attempt to stop and resume pending layout
actions which can't be done if layout is underway, hence the assert from the
inner SwLayAction::SwLayAction triggered by the runstate while an SwLayAction::SwLayAction
is already active for counting the number of pdf output pages.

getMapUnit always returns the same result regardless of anything else and the
assumption is that we don't need to be in run state to setVisualSize on it

Change-Id: Ie75b159b140de223a56324b39699d703c3b40bb9
üst 1a08ce70
...@@ -53,12 +53,16 @@ void SAL_CALL OCommonEmbeddedObject::setVisualAreaSize( sal_Int64 nAspect, const ...@@ -53,12 +53,16 @@ void SAL_CALL OCommonEmbeddedObject::setVisualAreaSize( sal_Int64 nAspect, const
bool bBackToLoaded = false; bool bBackToLoaded = false;
if ( m_nObjectState == embed::EmbedStates::LOADED ) if ( m_nObjectState == embed::EmbedStates::LOADED )
{
//attempt an optimization for chart components
if (!IsChartComponent())
{ {
changeState( embed::EmbedStates::RUNNING ); changeState( embed::EmbedStates::RUNNING );
// the links should be switched back to loaded state for now to avoid locking problems // the links should be switched back to loaded state for now to avoid locking problems
bBackToLoaded = m_bIsLink; bBackToLoaded = m_bIsLink;
} }
}
bool bSuccess = m_pDocHolder->SetExtent( nAspect, aSize ); bool bSuccess = m_pDocHolder->SetExtent( nAspect, aSize );
...@@ -132,12 +136,16 @@ sal_Int32 SAL_CALL OCommonEmbeddedObject::getMapUnit( sal_Int64 nAspect ) ...@@ -132,12 +136,16 @@ sal_Int32 SAL_CALL OCommonEmbeddedObject::getMapUnit( sal_Int64 nAspect )
bool bBackToLoaded = false; bool bBackToLoaded = false;
if ( m_nObjectState == embed::EmbedStates::LOADED ) if ( m_nObjectState == embed::EmbedStates::LOADED )
{
//attempt an optimization for chart components
if (!IsChartComponent())
{ {
changeState( embed::EmbedStates::RUNNING ); changeState( embed::EmbedStates::RUNNING );
// the links should be switched back to loaded state for now to avoid locking problems // the links should be switched back to loaded state for now to avoid locking problems
bBackToLoaded = m_bIsLink; bBackToLoaded = m_bIsLink;
} }
}
sal_Int32 nResult = m_pDocHolder->GetMapUnit( nAspect ); sal_Int32 nResult = m_pDocHolder->GetMapUnit( nAspect );
......
...@@ -171,6 +171,7 @@ private: ...@@ -171,6 +171,7 @@ private:
const OUString& aNewName ); const OUString& aNewName );
OUString GetDocumentServiceName() const { return m_aDocServiceName; } OUString GetDocumentServiceName() const { return m_aDocServiceName; }
bool IsChartComponent() const { return m_aDocServiceName == "com.sun.star.chart2.ChartDocument"; }
OUString GetPresetFilterName() const { return m_aPresetFilterName; } OUString GetPresetFilterName() const { return m_aPresetFilterName; }
::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >
......
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