sw/source/core/frmedt/fefly1.cxx | 3 ++- sw/source/core/frmedt/feshview.cxx | 14 +++++++++++--- 2 files changed, 13 insertions(+), 4 deletions(-)
New commits: commit 94506a71fab6f6d6e8d62b02ec78004f85c87aeb Author: Caolán McNamara <caol...@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/14117 Reviewed-by: Michael Stahl <mst...@redhat.com> Tested-by: Michael Stahl <mst...@redhat.com> diff --git a/sw/source/core/frmedt/fefly1.cxx b/sw/source/core/frmedt/fefly1.cxx index a88dd95..86d006a 100644 --- a/sw/source/core/frmedt/fefly1.cxx +++ b/sw/source/core/frmedt/fefly1.cxx @@ -431,7 +431,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 edbceef..9ff3ae1 100644 --- a/sw/source/core/frmedt/feshview.cxx +++ b/sw/source/core/frmedt/feshview.cxx @@ -1587,12 +1587,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 ) { @@ -1638,7 +1646,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() );
_______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits