[Libreoffice-commits] core.git: 2 commits - sw/source

Michael Stahl (via logerrit) logerrit at kemper.freedesktop.org
Wed Oct 30 13:46:43 UTC 2019


 sw/source/core/doc/docbm.cxx        |    4 +++-
 sw/source/core/unocore/unoframe.cxx |    8 ++++++++
 2 files changed, 11 insertions(+), 1 deletion(-)

New commits:
commit 81112d875f1c29f1244e7f283f90d56cfbe5b5b4
Author:     Michael Stahl <Michael.Stahl at cib.de>
AuthorDate: Tue Oct 29 18:37:23 2019 +0100
Commit:     Michael Stahl <michael.stahl at cib.de>
CommitDate: Wed Oct 30 14:44:45 2019 +0100

    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 at cib.de>

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 );
commit a631fbe78881707b74025f6ba392f100aad6419f
Author:     Michael Stahl <Michael.Stahl at cib.de>
AuthorDate: Tue Oct 29 17:40:02 2019 +0100
Commit:     Michael Stahl <michael.stahl at cib.de>
CommitDate: Wed Oct 30 14:44:31 2019 +0100

    sw: makeMark(): insert CH_TXT_ATR before inserting into sorted vector
    
    ... because if the new fieldmark is exactly around an existing
    fieldmark, we get this on tdf112797-3.docx:
    sw/source/core/doc/docbm.cxx:481: void {anonymous}::lcl_DebugMarks(const container_t&): Assertion `std::is_sorted(rMarks.begin(), rMarks.end(), lcl_MarkOrderingByStart)' failed.
    
    Change-Id: If998c95d4c6c40654936773defc674ee55f736c4
    Reviewed-on: https://gerrit.libreoffice.org/81700
    Tested-by: Jenkins
    Reviewed-by: Michael Stahl <michael.stahl at cib.de>

diff --git a/sw/source/core/doc/docbm.cxx b/sw/source/core/doc/docbm.cxx
index b3d0470a3124..fed537289400 100644
--- a/sw/source/core/doc/docbm.cxx
+++ b/sw/source/core/doc/docbm.cxx
@@ -642,6 +642,9 @@ namespace sw { namespace mark
         if ( eType != IDocumentMarkAccess::MarkType::UNO_BOOKMARK )
             pMark->SetName( getUniqueMarkName( pMark->GetName() ) );
 
+        // insert any dummy chars before inserting into sorted vectors
+        pMark->InitDoc(m_pDoc, eMode, pSepPos);
+
         // register mark
         lcl_InsertMarkSorted(m_vAllMarks, pMark.get());
         switch(eType)
@@ -666,7 +669,6 @@ namespace sw { namespace mark
                 // no special array for these
                 break;
         }
-        pMark->InitDoc(m_pDoc, eMode, pSepPos);
         SAL_INFO("sw.core", "--- makeType ---");
         SAL_INFO("sw.core", "Marks");
         lcl_DebugMarks(m_vAllMarks);


More information about the Libreoffice-commits mailing list