[Libreoffice-commits] core.git: 3 commits - comphelper/source sw/inc sw/source

Michael Stahl mstahl at redhat.com
Wed Aug 28 05:51:59 PDT 2013


 comphelper/source/misc/accessibleeventnotifier.cxx |   33 ++++++++-------
 sw/inc/crstate.hxx                                 |    2 
 sw/source/core/layout/trvlfrm.cxx                  |   45 +++++++++++++++++++--
 sw/source/ui/docvw/edtwin.cxx                      |    4 +
 4 files changed, 65 insertions(+), 19 deletions(-)

New commits:
commit a2c67975c03010b90c706523293f180c1f29e229
Author: Michael Stahl <mstahl at redhat.com>
Date:   Wed Aug 28 14:28:40 2013 +0200

    fdo#67358: sw: "fix" line painting artifacts when resizing columns
    
    SwEditWin::MouseButtonDown(): for unknown reasons invalidating the
    window here causes the column resizing lines to not be removed after the
    resize is done, so disable it.
    
    (regression from 289185fd02d6d9734b6dbde01f15c4e6c5beacbb)
    
    Change-Id: If3ba0a72c53c5c2734fb905ae35d62f6a3e8938b

diff --git a/sw/source/ui/docvw/edtwin.cxx b/sw/source/ui/docvw/edtwin.cxx
index eae062e..3321d28 100644
--- a/sw/source/ui/docvw/edtwin.cxx
+++ b/sw/source/ui/docvw/edtwin.cxx
@@ -2807,7 +2807,9 @@ void SwEditWin::MouseButtonDown(const MouseEvent& _rMEvt)
             rSh.SetShowHeaderFooterSeparator( Footer, false );
 
             // Repaint everything
-            rSh.GetWin()->Invalidate();
+            // FIXME fdo#67358 for unknown reasons this causes painting
+            // problems when resizing table columns, so disable it
+//            rSh.GetWin()->Invalidate();
         }
     }
 
commit edd2db1c783bd571ff796a5298385cacc91877b9
Author: Michael Stahl <mstahl at redhat.com>
Date:   Wed Aug 28 14:16:38 2013 +0200

    fdo#66215: sw: fix clicking on text above background fly
    
    SwPageFrm::GetCrsrOfst() tries to compare the distance to the closest
    text vs. fly but does not do it right because GetCharRect()
    returns just a line of width 1 on the left edge of the character;
    try to figure out the entire area covered by the character via 2 calls
    to GetCrsrOfst(), which gives much better clickability.
    
    (regression from e8fbe97900f13305b17015d9044993bde4adab36)
    
    Change-Id: I825e86daf65692dfb962ad576772c5f543d02d19

diff --git a/sw/inc/crstate.hxx b/sw/inc/crstate.hxx
index 6c8c86f..7bd3cb4 100644
--- a/sw/inc/crstate.hxx
+++ b/sw/inc/crstate.hxx
@@ -143,7 +143,7 @@ struct SwCrsrMoveState
     sal_Bool bRealWidth;            ///< Calculation of the width required
     sal_Bool b2Lines;               ///< Check 2line portions and fill p2Lines
     sal_Bool bNoScroll;             ///< No scrolling of undersized textframes
-    sal_Bool bPosMatchesBounds;     /**< GetCrsrOfst should not return the next
+    bool bPosMatchesBounds;         /**< GetCrsrOfst should not return the next
                                        position if screen position is inside second
                                        have of bound rect */
 
diff --git a/sw/source/core/layout/trvlfrm.cxx b/sw/source/core/layout/trvlfrm.cxx
index 81671bb..2b5ca6e 100644
--- a/sw/source/core/layout/trvlfrm.cxx
+++ b/sw/source/core/layout/trvlfrm.cxx
@@ -19,6 +19,7 @@
 
 #include <hintids.hxx>
 #include <hints.hxx>
+#include <comphelper/flagguard.hxx>
 #include <tools/bigint.hxx>
 #include <tools/line.hxx>
 #include <editeng/opaqitem.hxx>
@@ -283,10 +284,48 @@ sal_Bool SwPageFrm::GetCrsrOfst( SwPosition *pPos, Point &rPoint,
             if ( pTextNd )
             {
                 SwCntntFrm* pTextFrm = pTextNd->getLayoutFrm( getRootFrm( ) );
-                SwRect rTextRect;
-                pTextFrm->GetCharRect( rTextRect, aTextPos );
 
-                nTextDistance = lcl_getDistance( rTextRect, rPoint );
+                // try this again but prefer the "previous" position
+                SwCrsrMoveState aMoveState;
+                SwCrsrMoveState *const pState((pCMS) ? pCMS : &aMoveState);
+                comphelper::FlagRestorationGuard g(
+                        pState->bPosMatchesBounds, true);
+                SwPosition prevTextPos(*pPos);
+                SwLayoutFrm::GetCrsrOfst(&prevTextPos, aPoint, pState);
+
+                SwRect aTextRect;
+                pTextFrm->GetCharRect(aTextRect, prevTextPos);
+
+                if (prevTextPos.nContent < pTextNd->Len())
+                {
+                    // aRextRect is just a line on the left edge of the
+                    // previous character; to get a better measure from
+                    // lcl_getDistance, extend that to a rectangle over
+                    // the entire character.
+                    SwPosition const nextTextPos(prevTextPos.nNode,
+                            SwIndex(prevTextPos.nContent, +1));
+                    SwRect nextTextRect;
+                    pTextFrm->GetCharRect(nextTextRect, nextTextPos);
+                    SWRECTFN(pTextFrm);
+                    if ((aTextRect.*fnRect->fnGetTop)() ==
+                        (nextTextRect.*fnRect->fnGetTop)()) // same line?
+                    {
+                        // need to handle mixed RTL/LTR portions somehow
+                        if ((aTextRect.*fnRect->fnGetLeft)() <
+                            (nextTextRect.*fnRect->fnGetLeft)())
+                        {
+                            (aTextRect.*fnRect->fnSetRight)(
+                                    (nextTextRect.*fnRect->fnGetLeft)());
+                        }
+                        else // RTL
+                        {
+                            (aTextRect.*fnRect->fnSetLeft)(
+                                    (nextTextRect.*fnRect->fnGetLeft)());
+                        }
+                    }
+                }
+
+                nTextDistance = lcl_getDistance(aTextRect, rPoint);
                 bValidTextDistance = true;
             }
 
commit cafff1bbc4effac74bbd2607fb83dd2547c8fa2e
Author: Michael Stahl <mstahl at redhat.com>
Date:   Tue Aug 27 21:43:48 2013 +0200

    rhbz#1001768: avoid deadlock in AccessibleEventNotifier
    
    revokeClientNotifyDisposing(): drop the static lclMutex before calling
    pListeners->disposeAndClear(), which may want to acquire the SolarMutex
    and deadlock.
    
    Change-Id: Ib35fc7fad6596450a3b10d58d5193b9b55c575cb

diff --git a/comphelper/source/misc/accessibleeventnotifier.cxx b/comphelper/source/misc/accessibleeventnotifier.cxx
index e6e88de..14ac88c7 100644
--- a/comphelper/source/misc/accessibleeventnotifier.cxx
+++ b/comphelper/source/misc/accessibleeventnotifier.cxx
@@ -133,29 +133,34 @@ namespace comphelper
     void AccessibleEventNotifier::revokeClientNotifyDisposing( const TClientId _nClient,
             const Reference< XInterface >& _rxEventSource ) SAL_THROW( ( ) )
     {
-        ::osl::MutexGuard aGuard( lclMutex::get() );
+        EventListeners * pListeners(0);
 
-        ClientMap::iterator aClientPos;
-        if ( !implLookupClient( _nClient, aClientPos ) )
-            // already asserted in implLookupClient
-            return;
+        {
+            // rhbz#1001768 drop the mutex before calling disposeAndClear
+            ::osl::MutexGuard aGuard( lclMutex::get() );
+
+            ClientMap::iterator aClientPos;
+            if (!implLookupClient(_nClient, aClientPos))
+                // already asserted in implLookupClient
+                return;
+
+            // notify the listeners
+            pListeners = aClientPos->second;
+
+            // we do not need the entry in the clients map anymore
+            // (do this before actually notifying, because some client
+            // implementations have re-entrance problems and call into
+            // revokeClient while we are notifying from here)
+            Clients::get().erase(aClientPos);
+        }
 
         // notify the "disposing" event for this client
         EventObject aDisposalEvent;
         aDisposalEvent.Source = _rxEventSource;
 
-        // notify the listeners
-        EventListeners* pListeners = aClientPos->second;
-
-        // we do not need the entry in the clients map anymore
-        // (do this before actually notifying, because some client implementations have re-entrance
-        // problems and call into revokeClient while we are notifying from hereing)
-        Clients::get().erase( aClientPos );
-
         // now really do the notification
         pListeners->disposeAndClear( aDisposalEvent );
         delete pListeners;
-
     }
 
     //---------------------------------------------------------------------


More information about the Libreoffice-commits mailing list