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

Caolán McNamara caolanm at redhat.com
Thu Jan 22 14:41:47 PST 2015


 sw/source/core/frmedt/fefly1.cxx   |    3 ++-
 sw/source/core/frmedt/feshview.cxx |   14 +++++++++++---
 2 files changed, 13 insertions(+), 4 deletions(-)

New commits:
commit 87eb4fb1a43d799c9ae8df11bd8b9381d2d88cdb
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Thu Jan 22 16:35:03 2015 +0000

    Resolves: fdo#87760 if we can't anchor at hidden text then...
    
    anchor to the page instead
    
    ane don't crash on searching for a place to put the anchor
    
    1 press return in an empty writer doc a few times
    2 insert a stock 2x2 table
    4 enter A1 and change format->character to hidden
    A1
    3 draw a rectangle above A1 so it'll get anchored to paragraph above table
    5 draw rectangle anchor into A1
    
    (cherry picked from commit 15faeb4f9f111f7ea8d04fd64b3d065971cd4570)
    
    Change-Id: Ib7931fdd1c70e809ec442aeac125879980e20ec9
    Reviewed-on: https://gerrit.libreoffice.org/14118
    Reviewed-by: Michael Stahl <mstahl at redhat.com>
    Tested-by: Michael Stahl <mstahl at redhat.com>

diff --git a/sw/source/core/frmedt/fefly1.cxx b/sw/source/core/frmedt/fefly1.cxx
index d7300e0..03a6b12 100644
--- a/sw/source/core/frmedt/fefly1.cxx
+++ b/sw/source/core/frmedt/fefly1.cxx
@@ -428,7 +428,8 @@ Point SwFEShell::FindAnchorPos( const Point& rAbsPos, bool bMoveIt )
         if ( nAnchorId != FLY_AT_CHAR
              || !PosInsideInputFld( aPos ) )
         {
-            pTxtFrm = aPos.nNode.GetNode().GetCntntNode()->getLayoutFrm( GetLayout(), 0, &aPos, false );
+            SwCntntNode* pCNode = aPos.nNode.GetNode().GetCntntNode();
+            pTxtFrm = pCNode ? pCNode->getLayoutFrm(GetLayout(), 0, &aPos, false) : NULL;
         }
     }
     const SwFrm *pNewAnch = NULL;
diff --git a/sw/source/core/frmedt/feshview.cxx b/sw/source/core/frmedt/feshview.cxx
index 0513275..90286b0 100644
--- a/sw/source/core/frmedt/feshview.cxx
+++ b/sw/source/core/frmedt/feshview.cxx
@@ -1570,12 +1570,20 @@ bool SwFEShell::ImpEndCreate()
         GetLayout()->GetCrsrOfst( &aPos, aPoint, &aState );
 
         // do not set in ReadnOnly-content
-        if( aPos.nNode.GetNode().IsProtect() )
+        if (aPos.nNode.GetNode().IsProtect())
+        {
             // then only page bound. Or should we
             // search the next not-readonly position?
             bAtPage = true;
+        }
 
-        pAnch = aPos.nNode.GetNode().GetCntntNode()->getLayoutFrm( GetLayout(), &aPoint, 0, false );
+        SwCntntNode* pCNode = aPos.nNode.GetNode().GetCntntNode();
+        pAnch = pCNode ? pCNode->getLayoutFrm( GetLayout(), &aPoint, 0, false ) : NULL;
+        if (!pAnch)
+        {
+            // Hidden content. Anchor to the page instead
+            bAtPage = true;
+        }
 
         if( !bAtPage )
         {
@@ -1621,7 +1629,7 @@ bool SwFEShell::ImpEndCreate()
 
         if( bAtPage )
         {
-            pPage = pAnch->FindPageFrm();
+            pPage = pAnch ? pAnch->FindPageFrm() : GetLayout()->GetPageAtPos(aPoint);
 
             aAnch.SetType( FLY_AT_PAGE );
             aAnch.SetPageNum( pPage->GetPhyPageNum() );


More information about the Libreoffice-commits mailing list