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:13 +0000 |
commit | 87eb4fb1a43d799c9ae8df11bd8b9381d2d88cdb (patch) | |
tree | f60628f3f1d579041163ba8ef9fedda79ecdc90c | |
parent | 38a2bda69b5052a72e1489f23b06dabf55062d83 (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/14118
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 d7300e0f0310..03a6b12bcac9 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 0513275d9bc4..90286b08fd94 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() ); |