[Libreoffice-commits] core.git: embeddedobj/source

Caolán McNamara caolanm at redhat.com
Fri Mar 27 03:46:17 PDT 2015


 embeddedobj/source/commonembedding/visobj.cxx |   20 ++++++++++++++------
 embeddedobj/source/inc/commonembobj.hxx       |    1 +
 2 files changed, 15 insertions(+), 6 deletions(-)

New commits:
commit 757f461ef12548af0be470f7c05ff67df3dc1314
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Thu Mar 26 21:15:59 2015 +0000

    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

diff --git a/embeddedobj/source/commonembedding/visobj.cxx b/embeddedobj/source/commonembedding/visobj.cxx
index 9f2af1e..4f42bb0 100644
--- a/embeddedobj/source/commonembedding/visobj.cxx
+++ b/embeddedobj/source/commonembedding/visobj.cxx
@@ -54,10 +54,14 @@ void SAL_CALL OCommonEmbeddedObject::setVisualAreaSize( sal_Int64 nAspect, const
     bool bBackToLoaded = false;
     if ( m_nObjectState == embed::EmbedStates::LOADED )
     {
-        changeState( embed::EmbedStates::RUNNING );
+        //attempt an optimization for chart components
+        if (!IsChartComponent())
+        {
+            changeState( embed::EmbedStates::RUNNING );
 
-        // the links should be switched back to loaded state for now to avoid locking problems
-        bBackToLoaded = m_bIsLink;
+            // the links should be switched back to loaded state for now to avoid locking problems
+            bBackToLoaded = m_bIsLink;
+        }
     }
 
     bool bSuccess = m_pDocHolder->SetExtent( nAspect, aSize );
@@ -133,10 +137,14 @@ sal_Int32 SAL_CALL OCommonEmbeddedObject::getMapUnit( sal_Int64 nAspect )
     bool bBackToLoaded = false;
     if ( m_nObjectState == embed::EmbedStates::LOADED )
     {
-        changeState( embed::EmbedStates::RUNNING );
+        //attempt an optimization for chart components
+        if (!IsChartComponent())
+        {
+            changeState( embed::EmbedStates::RUNNING );
 
-        // the links should be switched back to loaded state for now to avoid locking problems
-        bBackToLoaded = m_bIsLink;
+            // the links should be switched back to loaded state for now to avoid locking problems
+            bBackToLoaded = m_bIsLink;
+        }
     }
 
     sal_Int32 nResult = m_pDocHolder->GetMapUnit( nAspect );
diff --git a/embeddedobj/source/inc/commonembobj.hxx b/embeddedobj/source/inc/commonembobj.hxx
index 0b713e0..ae3a09a 100644
--- a/embeddedobj/source/inc/commonembobj.hxx
+++ b/embeddedobj/source/inc/commonembobj.hxx
@@ -171,6 +171,7 @@ private:
                 const OUString& aNewName );
 
     OUString GetDocumentServiceName() const { return m_aDocServiceName; }
+    bool IsChartComponent() const { return m_aDocServiceName == "com.sun.star.chart2.ChartDocument"; }
     OUString GetPresetFilterName() const { return m_aPresetFilterName; }
 
     ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >


More information about the Libreoffice-commits mailing list