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

Michael Stahl (via logerrit) logerrit at kemper.freedesktop.org
Wed Oct 23 11:04:26 UTC 2019


 sw/source/core/doc/DocumentContentOperationsManager.cxx |    5 ++++-
 sw/source/core/doc/docbm.cxx                            |   16 +++++++++++++---
 sw/source/core/txtnode/swfont.cxx                       |    2 ++
 3 files changed, 19 insertions(+), 4 deletions(-)

New commits:
commit a0fa6911a013dc5cc844fdbee13132a467f4a437
Author:     Michael Stahl <Michael.Stahl at cib.de>
AuthorDate: Tue Oct 15 12:41:37 2019 +0200
Commit:     Michael Stahl <michael.stahl at cib.de>
CommitDate: Wed Oct 23 13:03:14 2019 +0200

    sw: fix copying of fieldmarks in lcl_CopyBookmarks()
    
    Surprisingly this handles CHECKBOX_FIELDMARK differently than the others
    but clearly it's a bug not to copy a fully selected TEXT_FIELDMARK as
    seen in CppunitTest_sw_ooxmlexport testMultiPageToc, where a header is
    copied with its CH_TXT_ATR_FIELD* but not the fieldmark.
    
    Change-Id: Ibf4d934ea834c1ac9fe4e541259605a745246049
    Reviewed-on: https://gerrit.libreoffice.org/80914
    Tested-by: Jenkins
    Reviewed-by: Michael Stahl <michael.stahl at cib.de>

diff --git a/sw/source/core/doc/DocumentContentOperationsManager.cxx b/sw/source/core/doc/DocumentContentOperationsManager.cxx
index baff9f898f4d..c7faedd49eab 100644
--- a/sw/source/core/doc/DocumentContentOperationsManager.cxx
+++ b/sw/source/core/doc/DocumentContentOperationsManager.cxx
@@ -251,7 +251,10 @@ namespace
             if ( rMarkStart >= rStt && rMarkEnd <= rEnd
                  && ( bIsNotOnBoundary
                       || aMarkType == IDocumentMarkAccess::MarkType::ANNOTATIONMARK
-                      || aMarkType == IDocumentMarkAccess::MarkType::CHECKBOX_FIELDMARK ) )
+                      || aMarkType == IDocumentMarkAccess::MarkType::TEXT_FIELDMARK
+                      || aMarkType == IDocumentMarkAccess::MarkType::CHECKBOX_FIELDMARK
+                      || aMarkType == IDocumentMarkAccess::MarkType::DROPDOWN_FIELDMARK
+                      || aMarkType == IDocumentMarkAccess::MarkType::DATE_FIELDMARK))
             {
                 vMarksToCopy.push_back(pMark);
             }
commit 19a559b0ec9b806519c405651d6d2b2e14712b4a
Author:     Michael Stahl <Michael.Stahl at cib.de>
AuthorDate: Mon Oct 14 16:55:50 2019 +0200
Commit:     Michael Stahl <michael.stahl at cib.de>
CommitDate: Wed Oct 23 13:02:52 2019 +0200

    sw: SwSubFont::GetTextSize_() assert on presumably dead code
    
    Change-Id: Iced0776a719dbc7e9d19db7bd547c408caa6a04f
    Reviewed-on: https://gerrit.libreoffice.org/80913
    Tested-by: Jenkins
    Reviewed-by: Michael Stahl <michael.stahl at cib.de>

diff --git a/sw/source/core/txtnode/swfont.cxx b/sw/source/core/txtnode/swfont.cxx
index 4de9b2b2ee90..9816212aa690 100644
--- a/sw/source/core/txtnode/swfont.cxx
+++ b/sw/source/core/txtnode/swfont.cxx
@@ -1118,6 +1118,7 @@ Size SwSubFont::GetTextSize_( SwDrawTextInfo& rInf )
     if (TextFrameIndex(1) == rInf.GetLen()
         && CH_TXT_ATR_FIELDSTART == rInf.GetText()[sal_Int32(rInf.GetIdx())])
     {
+        assert(!"this is presumably dead code");
         TextFrameIndex const nOldIdx(rInf.GetIdx());
         TextFrameIndex const nOldLen(rInf.GetLen());
         const OUString aNewText(CH_TXT_ATR_SUBST_FIELDSTART);
@@ -1131,6 +1132,7 @@ Size SwSubFont::GetTextSize_( SwDrawTextInfo& rInf )
     else if (TextFrameIndex(1) == rInf.GetLen()
             && CH_TXT_ATR_FIELDEND == rInf.GetText()[sal_Int32(rInf.GetIdx())])
     {
+        assert(!"this is presumably dead code");
         TextFrameIndex const nOldIdx(rInf.GetIdx());
         TextFrameIndex const nOldLen(rInf.GetLen());
         const OUString aNewText(CH_TXT_ATR_SUBST_FIELDEND);
commit d426964c0d3e42058f93f764eab1257cf9d21d4c
Author:     Michael Stahl <Michael.Stahl at cib.de>
AuthorDate: Mon Oct 14 16:45:28 2019 +0200
Commit:     Michael Stahl <michael.stahl at cib.de>
CommitDate: Wed Oct 23 13:02:34 2019 +0200

    sw: getFieldmarkFor() and GetCurrentFieldmark() return innermost one
    
    In case of nested fieldmarks, this seems plausible to me.
    
    Change-Id: Iefa6a3836421fc93d7687eeb608f21d63fb45e81
    Reviewed-on: https://gerrit.libreoffice.org/80912
    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 4f94baab5c90..68914f38c0b3 100644
--- a/sw/source/core/doc/docbm.cxx
+++ b/sw/source/core/doc/docbm.cxx
@@ -1293,13 +1293,23 @@ namespace sw { namespace mark
 
     IFieldmark* MarkManager::getFieldmarkFor(const SwPosition& rPos) const
     {
-        auto const pFieldmark = find_if(
+        auto itFieldmark = find_if(
             m_vFieldmarks.begin(),
             m_vFieldmarks.end(),
             [&rPos] (const ::sw::mark::MarkBase *const pMark) { return pMark->IsCoveringPosition(rPos); } );
-        if(pFieldmark == m_vFieldmarks.end())
+        if (itFieldmark == m_vFieldmarks.end())
             return nullptr;
-        return dynamic_cast<IFieldmark*>(*pFieldmark);
+        auto pFieldmark(*itFieldmark);
+        for ( ; itFieldmark != m_vFieldmarks.end()
+                && (**itFieldmark).IsCoveringPosition(rPos); ++itFieldmark)
+        {   // find the innermost fieldmark
+            if (pFieldmark->GetMarkStart() < (**itFieldmark).GetMarkStart()
+                || (**itFieldmark).GetMarkEnd() < pFieldmark->GetMarkEnd())
+            {
+                pFieldmark = *itFieldmark;
+            }
+        }
+        return dynamic_cast<IFieldmark*>(pFieldmark);
     }
 
     void MarkManager::deleteFieldmarkAt(const SwPosition& rPos)


More information about the Libreoffice-commits mailing list