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

Michael Stahl mstahl at redhat.com
Mon Apr 20 02:03:06 PDT 2015


 cui/source/tabpages/tparea.cxx |   46 ++++++++++++++++++++++++-----------------
 vcl/source/outdev/text.cxx     |    3 +-
 2 files changed, 30 insertions(+), 19 deletions(-)

New commits:
commit 2cd486b1dd75d530d8c12eb223e5f215fa8f1944
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>

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 00dc0e2a2d505e5281a9f5a32fa658e5fca6a6ea
Author: Michael Stahl <mstahl at redhat.com>
Date:   Fri Apr 17 21:20:47 2015 +0200

    tdf#82784: cui: Area tab page: do not override imported bitmaps
    
    Check that we don't clobber a custom bitmap in the dialog.
    
    The (non-obvious) trick is that the name of these is non-empty, so we
    can check that to filter out pool default items that Draw likes to put
    into item sets (?), as well as just plain weird items that Draw likes to
    put into item sets, while avoiding relying on the surprisingly
    implemented ImpGraphic::operator==().
    
    (regression from 38d0047da7f964c862360b48d88cc869ad376b6b)
    
    (cherry picked from commit 171fb61c6526daf83d6948a543a1614215590946)
    
    Conflicts:
    	cui/source/tabpages/tparea.cxx
    
    Change-Id: I0b94e49ef3a9a32c188c3b117a57f780f55e1584
    Reviewed-on: https://gerrit.libreoffice.org/15372
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/cui/source/tabpages/tparea.cxx b/cui/source/tabpages/tparea.cxx
index 35db8ef..9f7803b 100644
--- a/cui/source/tabpages/tparea.cxx
+++ b/cui/source/tabpages/tparea.cxx
@@ -1423,28 +1423,35 @@ void SvxAreaTabPage::Reset( const SfxItemSet& rAttrs )
             m_pLbHatchBckgrdColor->SelectEntry( rColorItem.GetColorValue() );
         }
 
-        if (SFX_ITEM_DONTCARE != rAttrs.GetItemState(XATTR_FILLGRADIENT))
+        SfxItemState const eGradState(rAttrs.GetItemState(XATTR_FILLGRADIENT));
+        XFillGradientItem const* pGradientItem(NULL);
+        if (SFX_ITEM_DONTCARE != eGradState)
         {
-            XFillGradientItem const& rGradientItem(
-                static_cast<const XFillGradientItem&>(
-                                    rAttrs.Get(XATTR_FILLGRADIENT)) );
-            OUString  const aString( rGradientItem.GetName() );
-            XGradient const aGradient( rGradientItem.GetGradientValue() );
-
+            pGradientItem = &static_cast<const XFillGradientItem&>(
+                                    rAttrs.Get(XATTR_FILLGRADIENT));
+            OUString  const aString( pGradientItem->GetName() );
+            XGradient const aGradient( pGradientItem->GetGradientValue() );
             m_pLbGradient->SelectEntryByList(pGradientList, aString, aGradient);
         }
-        if (!m_pLbGradient->GetSelectEntryCount())
+        if (!m_pLbGradient->GetSelectEntryCount()
+            && (SFX_ITEM_DEFAULT == eGradState
+                || (pGradientItem && pGradientItem->GetName().isEmpty())))
         {   // avoid relying on pool default - cannot export that
             m_pLbGradient->SelectEntryPos(0); // anything better than nothing
             isMissingGradient = true;
         }
 
-        if (SFX_ITEM_DONTCARE != rAttrs.GetItemState(XATTR_FILLHATCH))
+        SfxItemState const eHatchState(rAttrs.GetItemState(XATTR_FILLHATCH));
+        XFillHatchItem const* pHatch(NULL);
+        if (SFX_ITEM_DONTCARE != eHatchState)
         {
-            m_pLbHatching->SelectEntry( static_cast<const XFillHatchItem&>(
-                            rAttrs.Get(XATTR_FILLHATCH)).GetName() );
+            pHatch = &static_cast<const XFillHatchItem&>(
+                                rAttrs.Get(XATTR_FILLHATCH));
+            m_pLbHatching->SelectEntry(pHatch->GetName());
         }
-        if (!m_pLbHatching->GetSelectEntryCount())
+        if (!m_pLbHatching->GetSelectEntryCount()
+            && (SFX_ITEM_DEFAULT == eHatchState
+                || (pHatch && pHatch->GetName().isEmpty())))
         {   // avoid relying on pool default - cannot export that
             m_pLbHatching->SelectEntryPos(0); // anything better than nothing
             isMissingHatching = true;
@@ -1455,14 +1462,17 @@ void SvxAreaTabPage::Reset( const SfxItemSet& rAttrs )
                         rAttrs.Get(XATTR_FILLBACKGROUND)).GetValue() );
         }
 
-        if (SFX_ITEM_DONTCARE != rAttrs.GetItemState(XATTR_FILLBITMAP))
+        SfxItemState const eBitmapState(rAttrs.GetItemState(XATTR_FILLBITMAP));
+        XFillBitmapItem const* pBitmapItem(NULL);
+        if (SFX_ITEM_DONTCARE != eBitmapState)
         {
-            XFillBitmapItem const& rBitmapItem(
-                    static_cast<const XFillBitmapItem&>(
-                        rAttrs.Get(XATTR_FILLBITMAP)));
-            m_pLbBitmap->SelectEntry(rBitmapItem.GetName());
+            pBitmapItem = &static_cast<const XFillBitmapItem&>(
+                            rAttrs.Get(XATTR_FILLBITMAP));
+            m_pLbBitmap->SelectEntry(pBitmapItem->GetName());
         }
-        if (!m_pLbBitmap->GetSelectEntryCount())
+        if (!m_pLbBitmap->GetSelectEntryCount()
+            && (SFX_ITEM_DEFAULT == eBitmapState
+                || (pBitmapItem && pBitmapItem->GetName().isEmpty())))
         {   // avoid relying on pool default - cannot export that
             m_pLbBitmap->SelectEntryPos(0); // anything better than nothing
             isMissingBitmap = true;


More information about the Libreoffice-commits mailing list