summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Stahl <Michael.Stahl@cib.de>2019-10-29 18:37:23 +0100
committerMichael Stahl <michael.stahl@cib.de>2019-10-30 14:44:45 +0100
commit81112d875f1c29f1244e7f283f90d56cfbe5b5b4 (patch)
tree32e9620e340b8d9e17dfb40bd05bce823d1c8b6b
parenta631fbe78881707b74025f6ba392f100aad6419f (diff)
sw: SwXFrame::attach(): re-anchoring AS_CHAR flys does not work
This happens on import of fdo75208-1.docx, where this: 9 writerfilter::dmapper::DomainMapper_Impl::appendTextContent(com::sun::star::uno::Reference<com::sun::star::text::XTextContent> const&, com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&) (this=0x6406be0, xContent=uno::Reference to (SwXTextFrame *) 0x6944030, xPropertyValues=empty uno::Sequence) at writerfilter/source/dmapper/DomainMapper_Impl.cxx:1845 10 writerfilter::dmapper::DomainMapper_Impl::PopShapeContext() (this=0x6406be0) at writerfilter/source/dmapper/DomainMapper_Impl.cxx:2620 11 writerfilter::dmapper::DomainMapper::lcl_endShape() (this=0x6406b10) at writerfilter/source/dmapper/DomainMapper.cxx:2989 ... somehow wants to reanchor it but the result is that the SwFormatAnchor in the SwFrameFormat points to one node and the SwTextFlyCnt hint and its CH_TXTATR dummy char are in a different node, and during text formatting we get sw/source/core/text/txtfrm.cxx:1261: TextFrameIndex SwTextFrame::MapModelToView(const SwTextNode*, sal_Int32) const: Assertion `static_cast<SwTextNode*>(const_cast<SwModify*>(SwFrame::GetDep())) == pNode' failed. If this is really intentional something, perhaps SwFrameFormat::Modify(), would need to move the hint too, but probably this is an accident. Change-Id: I4d2afec275f187a65d18c0bcd0fd17e12c42ed0a Reviewed-on: https://gerrit.libreoffice.org/81702 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.stahl@cib.de>
-rw-r--r--sw/source/core/unocore/unoframe.cxx8
1 files changed, 8 insertions, 0 deletions
diff --git a/sw/source/core/unocore/unoframe.cxx b/sw/source/core/unocore/unoframe.cxx
index d9db73e540ea..294db651c919 100644
--- a/sw/source/core/unocore/unoframe.cxx
+++ b/sw/source/core/unocore/unoframe.cxx
@@ -3096,6 +3096,14 @@ void SwXFrame::attach(const uno::Reference< text::XTextRange > & xTextRange)
SfxItemSet aSet( pDoc->GetAttrPool(), svl::Items<RES_ANCHOR, RES_ANCHOR>{} );
aSet.SetParent(&pFormat->GetAttrSet());
SwFormatAnchor aAnchor = aSet.Get(RES_ANCHOR);
+
+ if (aAnchor.GetAnchorId() == RndStdIds::FLY_AS_CHAR)
+ {
+ throw lang::IllegalArgumentException(
+ "SwXFrame::attach(): re-anchoring AS_CHAR not supported",
+ *this, 0);
+ }
+
aAnchor.SetAnchor( aIntPam.Start() );
aSet.Put(aAnchor);
pDoc->SetFlyFrameAttr( *pFormat, aSet );