diff options
author | Michael Stahl <Michael.Stahl@cib.de> | 2018-06-01 18:56:48 +0200 |
---|---|---|
committer | Thorsten Behrens <Thorsten.Behrens@CIB.de> | 2018-06-12 18:55:17 +0200 |
commit | 2325a96d7a98dc48f7a0d6c3681f0040cb828549 (patch) | |
tree | d2d87bd10424a68a3a8db26405a268f5c1d51ed4 | |
parent | sw_redlinehide: trivial GetNode() conversion in access (diff) | |
download | core-2325a96d7a98dc48f7a0d6c3681f0040cb828549.tar.gz core-2325a96d7a98dc48f7a0d6c3681f0040cb828549.zip |
sw_redlinehide: trivial GetNode() in docfld.cxx,docfly.cxx,doclay.cxx
Change-Id: I2f95b413a65fac0a68678eb06f90238707c57e68
-rw-r--r-- | sw/source/core/doc/docfld.cxx | 6 | ||||
-rw-r--r-- | sw/source/core/doc/docfly.cxx | 22 | ||||
-rw-r--r-- | sw/source/core/doc/doclay.cxx | 6 |
3 files changed, 26 insertions, 8 deletions
diff --git a/sw/source/core/doc/docfld.cxx b/sw/source/core/doc/docfld.cxx index b2c6e07842ea..c017172eed6d 100644 --- a/sw/source/core/doc/docfld.cxx +++ b/sw/source/core/doc/docfld.cxx @@ -34,6 +34,8 @@ #include <IDocumentState.hxx> #include <IDocumentLayoutAccess.hxx> #include <cntfrm.hxx> +#include <txtfrm.hxx> +#include <notxtfrm.hxx> #include <pam.hxx> #include <ndtxt.hxx> #include <swtable.hxx> @@ -186,7 +188,9 @@ void SetGetExpField::SetBodyPos( const SwContentFrame& rFrame ) { if( !rFrame.IsInDocBody() ) { - SwNodeIndex aIdx( *rFrame.GetNode() ); + SwNodeIndex aIdx( rFrame.IsTextFrame() + ? *static_cast<SwTextFrame const&>(rFrame).GetTextNodeFirst() + : *static_cast<SwNoTextFrame const&>(rFrame).GetNode() ); SwDoc& rDoc = *aIdx.GetNodes().GetDoc(); SwPosition aPos( aIdx ); bool const bResult = ::GetBodyTextNode( rDoc, aPos, rFrame ); diff --git a/sw/source/core/doc/docfly.cxx b/sw/source/core/doc/docfly.cxx index 6adcb47b894b..457229b88f66 100644 --- a/sw/source/core/doc/docfly.cxx +++ b/sw/source/core/doc/docfly.cxx @@ -42,6 +42,7 @@ #include <txtflcnt.hxx> #include <fmtflcnt.hxx> #include <txtfrm.hxx> +#include <notxtfrm.hxx> #include <pagefrm.hxx> #include <rootfrm.hxx> #include <flyfrms.hxx> @@ -801,7 +802,10 @@ bool SwDoc::ChgAnchor( const SdrMarkList& _rMrkList, } else { - SwPosition aPos( *static_cast<const SwContentFrame*>(pNewAnchorFrame)->GetNode() ); + SwPosition aPos( pNewAnchorFrame->IsTextFrame() + ? *static_cast<SwTextFrame const*>(pNewAnchorFrame)->GetTextNodeForParaProps() + : *static_cast<SwNoTextFrame const*>(pNewAnchorFrame)->GetNode() ); + aNewAnch.SetType( _eAnchorType ); aNewAnch.SetAnchor( &aPos ); } @@ -872,7 +876,10 @@ bool SwDoc::ChgAnchor( const SdrMarkList& _rMrkList, Point aPoint( aPt ); aPoint.setX(aPoint.getX() - 1); // Do not load in the DrawObj! aNewAnch.SetType( RndStdIds::FLY_AS_CHAR ); - SwPosition aPos( *static_cast<const SwContentFrame*>(pNewAnchorFrame)->GetNode() ); + assert(pNewAnchorFrame->IsTextFrame()); // because AS_CHAR + SwTextFrame const*const pFrame( + static_cast<SwTextFrame const*>(pNewAnchorFrame)); + SwPosition aPos( *pFrame->GetTextNodeForParaProps() ); if ( pNewAnchorFrame->getFrameArea().IsInside( aPoint ) ) { // We need to find a TextNode, because only there we can anchor a @@ -882,12 +889,15 @@ bool SwDoc::ChgAnchor( const SdrMarkList& _rMrkList, } else { - SwContentNode &rCNd = const_cast<SwContentNode&>( - *static_cast<const SwContentFrame*>(pNewAnchorFrame)->GetNode()); if ( pNewAnchorFrame->getFrameArea().Bottom() < aPt.Y() ) - rCNd.MakeStartIndex( &aPos.nContent ); + { + aPos = pFrame->MapViewToModelPos(TextFrameIndex(0)); + } else - rCNd.MakeEndIndex( &aPos.nContent ); + { + aPos = pFrame->MapViewToModelPos( + TextFrameIndex(pFrame->GetText().getLength())); + } } aNewAnch.SetAnchor( &aPos ); SetAttr( aNewAnch, *pContact->GetFormat() ); diff --git a/sw/source/core/doc/doclay.cxx b/sw/source/core/doc/doclay.cxx index d50c9f232f94..86ad696d877a 100644 --- a/sw/source/core/doc/doclay.cxx +++ b/sw/source/core/doc/doclay.cxx @@ -71,6 +71,8 @@ #include <rootfrm.hxx> #include <pagefrm.hxx> #include <cntfrm.hxx> +#include <txtfrm.hxx> +#include <notxtfrm.hxx> #include <flyfrm.hxx> #include <fesh.hxx> #include <docsh.hxx> @@ -580,7 +582,9 @@ SwPosFlyFrames SwDoc::GetAllFlyFormats( const SwPaM* pCmpRange, bool bDrawAlso, } if ( pContentFrame ) { - SwNodeIndex aIdx( *pContentFrame->GetNode() ); + SwNodeIndex aIdx( pContentFrame->IsTextFrame() + ? *static_cast<SwTextFrame const*>(pContentFrame)->GetTextNodeFirst() + : *static_cast<SwNoTextFrame const*>(pContentFrame)->GetNode() ); aRetval.insert(std::make_shared<SwPosFlyFrame>(aIdx, pFly, aRetval.size())); } } |