[Libreoffice-commits] .: 2 commits - sw/source

Cédric Bosdonnat cbosdo at kemper.freedesktop.org
Thu Jan 26 07:07:47 PST 2012


 sw/source/core/fields/reffld.cxx    |   37 +++++++++++++++++++++---------------
 sw/source/ui/docvw/PageBreakWin.cxx |   22 +++++++++++++++------
 2 files changed, 38 insertions(+), 21 deletions(-)

New commits:
commit 5e51960dede5015b862df05b7b16f02884647889
Author: Cédric Bosdonnat <cedric.bosdonnat.ooo at free.fr>
Date:   Thu Jan 26 15:30:01 2012 +0100

    fdo#35669: properly merge ref fields in master documents

diff --git a/sw/source/core/fields/reffld.cxx b/sw/source/core/fields/reffld.cxx
index e031700..5f1aa3a 100644
--- a/sw/source/core/fields/reffld.cxx
+++ b/sw/source/core/fields/reffld.cxx
@@ -972,6 +972,26 @@ void _RefIdsMap::Init( SwDoc& rDoc, SwDoc& rDestDoc, sal_Bool bField )
     {
         GetFieldIdsFromDoc( rDestDoc, aIds );
         GetFieldIdsFromDoc( rDoc, aDstIds );
+
+        // Define the mappings now
+        sal_uInt16 nMaxDstId = *aIds.end();
+
+        // Map all the src fields to their value + nMaxDstId
+        for ( std::set<sal_uInt16>::iterator pIt = aDstIds.begin(); pIt != aDstIds.end(); ++pIt )
+            AddId( nMaxDstId++, *pIt );
+
+        // Change the Sequence number of all the SetExp fields in the destination document
+        SwFieldType* pType = rDoc.GetFldType( RES_SETEXPFLD, aName, false );
+        if( pType )
+        {
+            SwIterator<SwFmtFld,SwFieldType> aIter( *pType );
+            for( SwFmtFld* pF = aIter.First(); pF; pF = aIter.Next() )
+                if( pF->GetTxtFld() )
+                {
+                    sal_uInt16 n = ((SwSetExpField*)pF->GetFld())->GetSeqNumber( );
+                    ((SwSetExpField*)pF->GetFld())->SetSeqNumber( sequencedIds[ n ] );
+                }
+        }
     }
     else
     {
@@ -1030,21 +1050,8 @@ void _RefIdsMap::Check( SwDoc& rDoc, SwDoc& rDestDoc, SwGetRefField& rFld,
             AddId( n, nSeqNo );
             rFld.SetSeqNo( n );
 
-            // und noch die Felder oder Fuss-/EndNote auf die neue
-            // Id umsetzen
-            if( bField )
-            {
-                SwFieldType* pType = rDoc.GetFldType( RES_SETEXPFLD, aName, false );
-                if( pType )
-                {
-                    SwIterator<SwFmtFld,SwFieldType> aIter( *pType );
-                    for( SwFmtFld* pF = aIter.First(); pF; pF = aIter.Next() )
-                        if( pF->GetTxtFld() && nSeqNo ==
-                            ((SwSetExpField*)pF->GetFld())->GetSeqNumber() )
-                            ((SwSetExpField*)pF->GetFld())->SetSeqNumber( n );
-                }
-            }
-            else
+            // und noch die Fuss-/EndNote auf die neue Id umsetzen
+            if( !bField )
             {
                 SwTxtFtn* pFtnIdx;
                 for( sal_uInt16 i = 0, nCnt = rDoc.GetFtnIdxs().Count(); i < nCnt; ++i )
commit 5fd72b4dc0191610e4d7b9cc30c5ec5b345150cb
Author: Cédric Bosdonnat <cedric.bosdonnat.ooo at free.fr>
Date:   Fri Jan 20 16:20:55 2012 +0100

    Revert "Page Breaks: IsLeaveWindow() is unreliable, we do not need it here."
    
    This reverts commit 60c968e9a2ef14aa289e677bd7f40d2c4724fd12. This
    introduced flickering page break button

diff --git a/sw/source/ui/docvw/PageBreakWin.cxx b/sw/source/ui/docvw/PageBreakWin.cxx
index ff5050b..0edeb61 100644
--- a/sw/source/ui/docvw/PageBreakWin.cxx
+++ b/sw/source/ui/docvw/PageBreakWin.cxx
@@ -83,11 +83,17 @@ namespace
 
     void SwBreakDashedLine::MouseMove( const MouseEvent& rMEvt )
     {
-        Point aEventPos( GetPosPixel() + rMEvt.GetPosPixel() );
-        if ( !m_pWin->Contains( aEventPos ) )
-            m_pWin->Fade( false );
+        if ( rMEvt.IsLeaveWindow() )
+        {
+            // don't fade if we just move to the 'button'
+            Point aEventPos( GetPosPixel() + rMEvt.GetPosPixel() );
+            if ( !m_pWin->Contains( aEventPos ) )
+                m_pWin->Fade( false );
+        }
         else if ( !m_pWin->IsVisible() )
+        {
             m_pWin->Fade( true );
+        }
 
         if ( !rMEvt.IsSynthetic() )
         {
@@ -303,9 +309,13 @@ void SwPageBreakWin::Select( )
 
 void SwPageBreakWin::MouseMove( const MouseEvent& rMEvt )
 {
-    Point aEventPos( rMEvt.GetPosPixel() + rMEvt.GetPosPixel() );
-    if ( !Contains( aEventPos ) && !PopupMenu::IsInExecute() )
-        Fade( false );
+    if ( rMEvt.IsLeaveWindow() )
+    {
+        // don't fade if we just move to the 'line', or the popup menu is open
+        Point aEventPos( rMEvt.GetPosPixel() + rMEvt.GetPosPixel() );
+        if ( !Contains( aEventPos ) && !PopupMenu::IsInExecute() )
+            Fade( false );
+    }
     else if ( !IsVisible() )
         Fade( true );
 }


More information about the Libreoffice-commits mailing list