return SwNode from SwContact::GetContentAnchor
part of the process of making SwFormatAnchor not use an SwPosition (because SwFormatAnchor does weird does with the internals of an SwPosition) Change-Id: I662f977214b70fa7eb37e460e4535e14e8a3fe28 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143222 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
This commit is contained in:
@@ -162,7 +162,7 @@ class SW_DLLPUBLIC SwAnchoredObject
|
||||
// object positioning
|
||||
friend bool sw_HideObj( const SwTextFrame& _rFrame,
|
||||
const RndStdIds _eAnchorType,
|
||||
SwPosition const& rAnchorPos,
|
||||
SwFormatAnchor const& rFormatAnchor,
|
||||
SwAnchoredObject* _pAnchoredObj );
|
||||
protected:
|
||||
SwAnchoredObject();
|
||||
|
||||
+4
-3
@@ -149,10 +149,11 @@ public:
|
||||
bool ObjAnchoredAtChar() const { return GetAnchorId() == RndStdIds::FLY_AT_CHAR; }
|
||||
bool ObjAnchoredAsChar() const { return GetAnchorId() == RndStdIds::FLY_AS_CHAR; }
|
||||
|
||||
const SwPosition& GetContentAnchor() const
|
||||
const SwNode& GetAnchorNode() const
|
||||
{
|
||||
assert( GetAnchorFormat().GetContentAnchor() );
|
||||
return *(GetAnchorFormat().GetContentAnchor());
|
||||
const SwNode* pNode = GetAnchorFormat().GetAnchorNode();
|
||||
assert( pNode );
|
||||
return *pNode;
|
||||
}
|
||||
|
||||
/** get data collection of anchored objects, handled by with contact */
|
||||
|
||||
@@ -771,7 +771,7 @@ bool SwDoc::ChgAnchor( const SdrMarkList& _rMrkList,
|
||||
const RndStdIds eOldAnchorType = pContact->GetAnchorId();
|
||||
if ( !_bSameOnly && eOldAnchorType == RndStdIds::FLY_AS_CHAR )
|
||||
{
|
||||
oOldAsCharAnchorPos.emplace(pContact->GetContentAnchor());
|
||||
oOldAsCharAnchorPos.emplace(*pContact->GetAnchorFormat().GetContentAnchor());
|
||||
}
|
||||
|
||||
if ( _bSameOnly )
|
||||
|
||||
@@ -1489,8 +1489,8 @@ bool SwFEShell::ShouldObjectBeSelected(const Point& rPt)
|
||||
SwContact* pContact = static_cast<SwContact*>(pObj->GetUserCall());
|
||||
if (pContact && !pContact->ObjAnchoredAtPage() )
|
||||
{
|
||||
const SwPosition& rPos = pContact->GetContentAnchor();
|
||||
bool bInHdrFtr = GetDoc()->IsInHeaderFooter( rPos.GetNode() );
|
||||
const SwNode& rAnchorNode = pContact->GetAnchorNode();
|
||||
bool bInHdrFtr = GetDoc()->IsInHeaderFooter( rAnchorNode );
|
||||
if (IsHeaderFooterEdit() != bInHdrFtr)
|
||||
{
|
||||
bRet = false;
|
||||
|
||||
@@ -1485,7 +1485,7 @@ void SwTextFrame::HideFootnotes(TextFrameIndex const nStart, TextFrameIndex cons
|
||||
*/
|
||||
bool sw_HideObj( const SwTextFrame& _rFrame,
|
||||
const RndStdIds _eAnchorType,
|
||||
SwPosition const& rAnchorPos,
|
||||
SwFormatAnchor const& rFormatAnchor,
|
||||
SwAnchoredObject* _pAnchoredObj )
|
||||
{
|
||||
bool bRet( true );
|
||||
@@ -1499,9 +1499,9 @@ bool sw_HideObj( const SwTextFrame& _rFrame,
|
||||
pIDSA->get(DocumentSettingId::CONSIDER_WRAP_ON_OBJECT_POSITION) &&
|
||||
_rFrame.IsInDocBody() && !_rFrame.FindNextCnt() )
|
||||
{
|
||||
SwTextNode const& rNode(*rAnchorPos.GetNode().GetTextNode());
|
||||
SwTextNode const& rNode(*rFormatAnchor.GetAnchorNode()->GetTextNode());
|
||||
assert(FrameContainsNode(_rFrame, rNode.GetIndex()));
|
||||
sal_Int32 const nObjAnchorPos(rAnchorPos.GetContentIndex());
|
||||
sal_Int32 const nObjAnchorPos(rFormatAnchor.GetContentAnchor()->GetContentIndex());
|
||||
const sal_Unicode cAnchorChar = nObjAnchorPos < rNode.Len()
|
||||
? rNode.GetText()[nObjAnchorPos]
|
||||
: 0;
|
||||
@@ -1560,7 +1560,7 @@ void SwTextFrame::HideAndShowObjects()
|
||||
// under certain conditions
|
||||
const RndStdIds eAnchorType( pContact->GetAnchorId() );
|
||||
if ((eAnchorType != RndStdIds::FLY_AT_CHAR) ||
|
||||
sw_HideObj(*this, eAnchorType, pContact->GetContentAnchor(),
|
||||
sw_HideObj(*this, eAnchorType, pContact->GetAnchorFormat(),
|
||||
i ))
|
||||
{
|
||||
pContact->MoveObjToInvisibleLayer( pObj );
|
||||
@@ -1594,13 +1594,13 @@ void SwTextFrame::HideAndShowObjects()
|
||||
{
|
||||
sal_Int32 nHiddenStart;
|
||||
sal_Int32 nHiddenEnd;
|
||||
const SwPosition& rAnchor = pContact->GetContentAnchor();
|
||||
const SwFormatAnchor& rAnchorFormat = pContact->GetAnchorFormat();
|
||||
SwScriptInfo::GetBoundsOfHiddenRange(
|
||||
*rAnchor.GetNode().GetTextNode(),
|
||||
rAnchor.GetContentIndex(), nHiddenStart, nHiddenEnd);
|
||||
*rAnchorFormat.GetAnchorNode()->GetTextNode(),
|
||||
rAnchorFormat.GetContentAnchor()->GetContentIndex(), nHiddenStart, nHiddenEnd);
|
||||
// Under certain conditions
|
||||
if ( nHiddenStart != COMPLETE_STRING && bShouldBeHidden &&
|
||||
sw_HideObj(*this, eAnchorType, rAnchor, i))
|
||||
sw_HideObj(*this, eAnchorType, rAnchorFormat, i))
|
||||
{
|
||||
pContact->MoveObjToInvisibleLayer( pObj );
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user