[Libreoffice-commits] core.git: Branch 'libreoffice-4-3-7' - 2 commits - sfx2/source vcl/source

Michael Stahl mstahl at redhat.com
Mon Apr 20 07:38:18 PDT 2015


 sfx2/source/appl/fileobj.cxx |   20 +++++++++++++-------
 sfx2/source/appl/fileobj.hxx |    2 ++
 vcl/source/outdev/text.cxx   |    3 ++-
 3 files changed, 17 insertions(+), 8 deletions(-)

New commits:
commit 05006dd3b2cd3e3961127d719e5a4d2c39aaa051
Author: Michael Stahl <mstahl at redhat.com>
Date:   Thu Apr 16 22:25:23 2015 +0200

    tdf#86793: vcl: speed up OutputDevice::GetEllipsisString()
    
    The ridiculous algrorithm used for TEXT_DRAW_CENTERELLIPSIS will go faster
    if we cut out most of the text at the beginning instead of one at a time.
    
    (regression from 912ecaf565e68d2ca3fb9584712313e712749f75)
    
    (cherry picked from commit c6ec3e4cee8c7c22380780f2661ac23946cdb050)
    
    Change-Id: I9310dda1847222215bafe372e3efef9d365e1ad9
    Reviewed-on: https://gerrit.libreoffice.org/15356
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>
    (cherry picked from commit 2cd486b1dd75d530d8c12eb223e5f215fa8f1944)
    Reviewed-on: https://gerrit.libreoffice.org/15439
    Reviewed-by: Eike Rathke <erack at redhat.com>
    Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>

diff --git a/vcl/source/outdev/text.cxx b/vcl/source/outdev/text.cxx
index 55ffe71..b9a23ca 100644
--- a/vcl/source/outdev/text.cxx
+++ b/vcl/source/outdev/text.cxx
@@ -1907,7 +1907,8 @@ OUString OutputDevice::ImplGetEllipsisString( const OutputDevice& rTargetDevice,
         if( (nStyle & TEXT_DRAW_CENTERELLIPSIS) == TEXT_DRAW_CENTERELLIPSIS )
         {
             OUStringBuffer aTmpStr( aStr );
-            sal_Int32 nEraseChars = 4;
+            // speed it up by removing all but 1.33x as many as the break pos.
+            sal_Int32 nEraseChars = std::max<sal_Int32>(4, aStr.getLength() - (nIndex*4)/3);
             while( nEraseChars < aStr.getLength() && _rLayout.GetTextWidth( aTmpStr.toString(), 0, aTmpStr.getLength() ) > nMaxWidth )
             {
                 aTmpStr = OUStringBuffer(aStr);
commit 9a4be346d24e7988d6b18eb89f39ae939c85418a
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Wed Apr 15 12:48:47 2015 +0100

    fix crash on re-export of fdo50057-2.odt to odt
    
    (cherry picked from commit 66c9aec156d974b939b680dccbb27e18fb153a23)
    Signed-off-by: Michael Stahl <mstahl at redhat.com>
    
    Conflicts:
    	sfx2/source/appl/fileobj.hxx
    
    Reviewed-on: https://gerrit.libreoffice.org/15326
    Reviewed-by: Michael Stahl <mstahl at redhat.com>
    Tested-by: Michael Stahl <mstahl at redhat.com>
    (cherry picked from commit 54e13b65a225dbb0778eb0bb6460dfa849064e0f)
    
    Change-Id: Ice7a754dd4f42b5cf62ae2038b63d893b8a92fd8
    Reviewed-on: https://gerrit.libreoffice.org/15433
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>
    Reviewed-by: Eike Rathke <erack at redhat.com>
    Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>

diff --git a/sfx2/source/appl/fileobj.cxx b/sfx2/source/appl/fileobj.cxx
index e123285..7ae5b6e 100644
--- a/sfx2/source/appl/fileobj.cxx
+++ b/sfx2/source/appl/fileobj.cxx
@@ -47,7 +47,9 @@
 #define FILETYPE_OBJECT     3
 
 SvFileObject::SvFileObject()
-    : pOldParent(NULL)
+    : nPostUserEventId(0)
+    , pDelMed(NULL)
+    , pOldParent(NULL)
     , nType(FILETYPE_TEXT)
     , bLoadAgain(true)
     , bSynchron(false)
@@ -64,14 +66,16 @@ SvFileObject::SvFileObject()
 
 SvFileObject::~SvFileObject()
 {
-    if ( xMed.Is() )
+    if (xMed.Is())
     {
         xMed->SetDoneLink( Link() );
         xMed.Clear();
     }
+    if (nPostUserEventId)
+        Application::RemoveUserEvent(nPostUserEventId);
+    delete pDelMed;
 }
 
-
 bool SvFileObject::GetData( ::com::sun::star::uno::Any & rData,
                                 const OUString & rMimeType,
                                 bool bGetSynchron )
@@ -482,10 +486,10 @@ IMPL_STATIC_LINK( SvFileObject, LoadGrfReady_Impl, void*, EMPTYARG )
         if( pThis->xMed.Is() )
         {
             pThis->xMed->SetDoneLink( Link() );
-
-            Application::PostUserEvent(
+            pThis->pDelMed = new SfxMediumRef(pThis->xMed);
+            pThis->nPostUserEventId = Application::PostUserEvent(
                         STATIC_LINK( pThis, SvFileObject, DelMedium_Impl ),
-                        new SfxMediumRef( pThis->xMed ));
+                        pThis->pDelMed);
             pThis->xMed.Clear();
         }
     }
@@ -495,7 +499,9 @@ IMPL_STATIC_LINK( SvFileObject, LoadGrfReady_Impl, void*, EMPTYARG )
 
 IMPL_STATIC_LINK( SvFileObject, DelMedium_Impl, SfxMediumRef*, pDelMed )
 {
-    (void)pThis;
+    pThis->nPostUserEventId = 0;
+    assert(pThis->pDelMed == pDelMed);
+    pThis->pDelMed = NULL;
     delete pDelMed;
     return 0;
 }
diff --git a/sfx2/source/appl/fileobj.hxx b/sfx2/source/appl/fileobj.hxx
index d43e1eb..5e602b7 100644
--- a/sfx2/source/appl/fileobj.hxx
+++ b/sfx2/source/appl/fileobj.hxx
@@ -33,6 +33,8 @@ class SvFileObject : public sfx2::SvLinkSource
     OUString            sReferer;
     Link                aEndEditLink;
     SfxMediumRef        xMed;
+    ImplSVEvent*        nPostUserEventId;
+    SfxMediumRef*       pDelMed;
     Window*             pOldParent;
 
     sal_uInt8 nType;


More information about the Libreoffice-commits mailing list