diff options
author | Caolán McNamara <caolanm@redhat.com> | 2015-01-22 16:35:03 +0000 |
---|---|---|
committer | Michael Stahl <mstahl@redhat.com> | 2015-01-22 22:41:35 +0000 |
commit | 94506a71fab6f6d6e8d62b02ec78004f85c87aeb (patch) | |
tree | e3b55aea353a54b50f20f9c29950b81f6d421e48 | |
parent | 2b325c5c009c1a73345520c03ffbf03dc4600eff (diff) |
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 <mstahl@redhat.com>
Tested-by: Michael Stahl <mstahl@redhat.com>
-rw-r--r-- | sw/source/core/frmedt/fefly1.cxx | 3 | ||||
-rw-r--r-- | sw/source/core/frmedt/feshview.cxx | 14 |
2 files changed, 13 insertions, 4 deletions
diff --git a/sw/source/core/frmedt/fefly1.cxx b/sw/source/core/frmedt/fefly1.cxx index a88dd95263e4..86d006a62e66 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 edbceef18e31..9ff3ae169825 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() ); |