sw/qa/core/data/ww8/pass/ofz19065.doc |binary
 sw/source/core/doc/docbm.cxx          |    9 +++++++++
 sw/source/filter/ww8/ww8par5.cxx      |    6 ------
 sw/source/filter/xml/xmlexpit.cxx     |    8 +++-----
 4 files changed, 12 insertions(+), 11 deletions(-)

New commits:
commit fbb3514aee8261211790b23586752d5be9ac2f34
Author:     Michael Stahl <michael.st...@cib.de>
AuthorDate: Mon Nov 25 15:51:24 2019 +0100
Commit:     Caolán McNamara <caol...@redhat.com>
CommitDate: Tue Nov 26 10:01:13 2019 +0100

    ofz#19065 sw: invalid fieldmarks created in SwWW8ImplReader::End_Field
    
    The problem is that the check added in commit
    06767a5394f1dfba71c4f0a2a07daa5664bdbd01 "sw: WW8: do not create
    fieldmark with start in frame and end in body" doesn't work as well as
    imagined; the CheckNodesRange will only check against mismatching
    top-level and second-level (in the non-body-text top-levels)
    sections, whereas in this case the start is in one table cell and the
    end in the next one.
    
    So replace that and move the check into MarkManager::makeMark(),
    so other things than WW8 import are also checked.
    
    Change-Id: I2bf32e7b579d87600b6b6718a3222f37c14aa53d
    Reviewed-on: https://gerrit.libreoffice.org/83585
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caol...@redhat.com>
    Tested-by: Caolán McNamara <caol...@redhat.com>

diff --git a/sw/qa/core/data/ww8/pass/ofz19065.doc 
b/sw/qa/core/data/ww8/pass/ofz19065.doc
new file mode 100644
index 000000000000..a242f13bf8e6
Binary files /dev/null and b/sw/qa/core/data/ww8/pass/ofz19065.doc differ
diff --git a/sw/source/core/doc/docbm.cxx b/sw/source/core/doc/docbm.cxx
index dec1b3d58654..f736348480a5 100644
--- a/sw/source/core/doc/docbm.cxx
+++ b/sw/source/core/doc/docbm.cxx
@@ -583,6 +583,15 @@ namespace sw { namespace mark
         }
 
         if ((eType == MarkType::TEXT_FIELDMARK || eType == 
MarkType::DATE_FIELDMARK)
+            && (rPaM.GetPoint()->nNode.GetNode().StartOfSectionNode() != 
rPaM.GetMark()->nNode.GetNode().StartOfSectionNode()
+                || (pSepPos && 
rPaM.GetPoint()->nNode.GetNode().StartOfSectionNode() != 
pSepPos->nNode.GetNode().StartOfSectionNode())))
+        {
+            SAL_WARN("sw.core", "MarkManager::makeMark(..)"
+                " - invalid range on fieldmark, different nodes array 
sections");
+            return nullptr;
+        }
+
+        if ((eType == MarkType::TEXT_FIELDMARK || eType == 
MarkType::DATE_FIELDMARK)
             // can't check for Copy - it asserts - but it's also obviously 
unnecessary
             && eMode == InsertMode::New
             && sw::mark::IsFieldmarkOverlap(rPaM))
diff --git a/sw/source/filter/ww8/ww8par5.cxx b/sw/source/filter/ww8/ww8par5.cxx
index 39e13b8cac5d..e6f31bb0736a 100644
--- a/sw/source/filter/ww8/ww8par5.cxx
+++ b/sw/source/filter/ww8/ww8par5.cxx
@@ -533,12 +533,6 @@ sal_uInt16 SwWW8ImplReader::End_Field()
         case ww::eFORMTEXT:
         if (bUseEnhFields && m_pPaM!=nullptr && m_pPaM->GetPoint()!=nullptr) {
             SwPosition aEndPos = *m_pPaM->GetPoint();
-            if (!::CheckNodesRange(m_aFieldStack.back().GetPtNode(),
-                        aEndPos.nNode, true))
-            {   // example ofz7322-1.doc
-                SAL_INFO("sw.ww8", "skipping field with invalid node range");
-                break;
-            }
             SwPaM aFieldPam( m_aFieldStack.back().GetPtNode(), 
m_aFieldStack.back().GetPtContent(), aEndPos.nNode, 
aEndPos.nContent.GetIndex());
             IDocumentMarkAccess* pMarksAccess = m_rDoc.getIDocumentMarkAccess( 
);
             IFieldmark *pFieldmark = pMarksAccess->makeFieldBookmark(
commit 85ed301feee92f799bcb9ddd54660a9f52ff5a2a
Author:     Caolán McNamara <caol...@redhat.com>
AuthorDate: Sun Nov 24 19:27:09 2019 +0000
Commit:     Caolán McNamara <caol...@redhat.com>
CommitDate: Tue Nov 26 10:00:31 2019 +0100

    dynamic_cast followed by the same dynamic_cast
    
    Change-Id: I182763eb693eb9f681ac90f25e6367919328d454
    Reviewed-on: https://gerrit.libreoffice.org/83618
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caol...@redhat.com>
    Tested-by: Caolán McNamara <caol...@redhat.com>

diff --git a/sw/source/filter/xml/xmlexpit.cxx 
b/sw/source/filter/xml/xmlexpit.cxx
index ab6ce1236e31..2c2391081b96 100644
--- a/sw/source/filter/xml/xmlexpit.cxx
+++ b/sw/source/filter/xml/xmlexpit.cxx
@@ -146,15 +146,13 @@ void SvXMLExportItemMapper::exportXML( const SvXMLExport& 
rExport,
                 rAttrList.AddAttribute( sName, aValue );
             }
         }
-        if( dynamic_cast<const SvXMLAttrContainerItem*>( &rItem) !=  nullptr )
+
+        if (const SvXMLAttrContainerItem *pUnknown = dynamic_cast<const 
SvXMLAttrContainerItem*>(&rItem))
         {
             std::unique_ptr<SvXMLNamespaceMap> pNewNamespaceMap;
             const SvXMLNamespaceMap *pNamespaceMap = &rNamespaceMap;
 
-            const SvXMLAttrContainerItem *pUnknown =
-                dynamic_cast<const SvXMLAttrContainerItem*>( &rItem  );
-
-            const sal_uInt16 nCount = pUnknown ? pUnknown->GetAttrCount() : 0;
+            const sal_uInt16 nCount = pUnknown->GetAttrCount();
             for( sal_uInt16 i=0; i < nCount; i++ )
             {
                 const OUString sPrefix( pUnknown->GetAttrPrefix( i ) );
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to