[Libreoffice-commits] .: Branch 'libreoffice-4-0' - 2 commits - sw/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Thu Dec 13 03:35:05 PST 2012


 sw/source/core/layout/atrfrm.cxx  |    5 +++++
 sw/source/core/layout/trvlfrm.cxx |   14 ++++++++------
 2 files changed, 13 insertions(+), 6 deletions(-)

New commits:
commit efa1a63d940c942c805f18696ce304aa47e04ef3
Author: Michael Stahl <mstahl at redhat.com>
Date:   Thu Dec 13 01:36:33 2012 +0100

    SwFmtAnchor::SetAnchor(): assert that position is on SwTxtNode
    
    Change-Id: I1c2a1cc2de4984cdcf1e5b8d0eafbd1471538e4a
    (cherry picked from commit 90a0116ccb48388d91b21128fcac2e4609838581)

diff --git a/sw/source/core/layout/atrfrm.cxx b/sw/source/core/layout/atrfrm.cxx
index a59d2d2..f5d7798 100644
--- a/sw/source/core/layout/atrfrm.cxx
+++ b/sw/source/core/layout/atrfrm.cxx
@@ -98,6 +98,9 @@
 #include <svl/cjkoptions.hxx>
 #include <switerator.hxx>
 #include <pagedeschint.hxx>
+#ifndef NDEBUG
+#include <ndtxt.hxx>
+#endif
 
 using namespace ::com::sun::star;
 using ::rtl::OUString;
@@ -1511,6 +1514,8 @@ SwFmtAnchor::~SwFmtAnchor()
 
 void SwFmtAnchor::SetAnchor( const SwPosition *pPos )
 {
+    // anchor only to paragraphs
+    assert(!pPos || dynamic_cast<SwTxtNode*>(&pPos->nNode.GetNode()));
     m_pCntntAnchor .reset( (pPos) ? new SwPosition( *pPos ) : 0 );
     // Flys anchored AT paragraph should not point into the paragraph content
     if (m_pCntntAnchor &&
commit 2ab2046fe7d939be02649b1c69f571cb19f9aeaa
Author: Michael Stahl <mstahl at redhat.com>
Date:   Thu Dec 13 01:28:59 2012 +0100

    fdo#58142: fix frame selection in SwPageFrm::GetCrsrOfst:
    
    The function does not handle the case where a paragraph was hit but no
    background frame was hit properly, which may or may not (depending on
    the platform) cause it to return a position of a frame when that is
    undesirable, such as when called from SwWrtShell::UnSelectFrm().
    
    When UnselectFrm() leaves a frame selected pasting multiple pictures
    leads to a crash.
    
    (regression from e8fbe97900f13305b17015d9044993bde4adab36)
    
    Change-Id: I3604825f654c523a37f47a9fc660647d8b3e7077
    (cherry picked from commit 2fc4af311656e7d019ca802d23444e5161f820ee)

diff --git a/sw/source/core/layout/trvlfrm.cxx b/sw/source/core/layout/trvlfrm.cxx
index a70b08d..443af12 100644
--- a/sw/source/core/layout/trvlfrm.cxx
+++ b/sw/source/core/layout/trvlfrm.cxx
@@ -264,8 +264,12 @@ sal_Bool SwPageFrm::GetCrsrOfst( SwPosition *pPos, Point &rPoint,
         if ( ( bTestBackground && bBackRet ) || !bTextRet )
         {
             bRet = bBackRet;
-            pPos->nNode = aBackPos.nNode;
-            pPos->nContent = aBackPos.nContent;
+            (*pPos) = aBackPos;
+        }
+        else if (bTextRet && !bBackRet)
+        {
+            bRet = bTextRet;
+            (*pPos) = aTextPos;
         }
         else
         {
@@ -306,14 +310,12 @@ sal_Bool SwPageFrm::GetCrsrOfst( SwPosition *pPos, Point &rPoint,
             if ( bValidTextDistance && bValidBackDistance && basegfx::fTools::more( nTextDistance, nBackDistance ) )
             {
                 bRet = bBackRet;
-                pPos->nNode = aBackPos.nNode;
-                pPos->nContent = aBackPos.nContent;
+                (*pPos) = aBackPos;
             }
             else
             {
                 bRet = bTextRet;
-                pPos->nNode = aTextPos.nNode;
-                pPos->nContent = aTextPos.nContent;
+                (*pPos) = aTextPos;
             }
         }
     }


More information about the Libreoffice-commits mailing list