[Libreoffice-commits] core.git: Branch 'libreoffice-4-3' - 2 commits - sw/inc sw/source

Miklos Vajna vmiklos at collabora.co.uk
Fri Jan 9 13:08:53 PST 2015


 sw/inc/ndtxt.hxx                  |    3 +++
 sw/source/core/text/txtfld.cxx    |   23 ++++++++++++++++++++++-
 sw/source/core/txtnode/thints.cxx |    7 +++----
 3 files changed, 28 insertions(+), 5 deletions(-)

New commits:
commit 54eb3d31b7be999468f1ae54a99730a8c739a22d
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Thu Nov 20 11:02:45 2014 +0100

    fdo#79810: SwTxtNode::IsIgnoredCharFmtForNumbering: ignore RES_CHRATR_COLOR
    
    And also in SwTxtFormatter::NewNumberPortion(), use
    SwTxtNode::IsIgnoredCharFmtForNumbering(), via
    checkApplyParagraphMarkFormatToNumbering().  Otherwise the color of the
    paragraph mark is inherited by the numbering portion, which is not what
    IDocumentSettingAccess::APPLY_PARAGRAPH_MARK_FORMAT_TO_NUMBERING
    (mirroring Word's behavior) is supposed to do.
    
    (cherry picked from commit b2c1474c1dc93b69f0ede03fc5c9ab496c669955)
    Signed-off-by: Michael Stahl <mstahl at redhat.com>
    
    This fixes regression fdo#79810.
    
    Conflicts:
    	sw/qa/extras/ooxmlexport/data/num-override-lvltext.docx
    	sw/qa/extras/ooxmlexport/ooxmlexport.cxx
    	sw/source/core/text/txtfld.cxx
    
    Change-Id: I5d8df9b404916cc4a4405bf796d971ede59e6111

diff --git a/sw/source/core/text/txtfld.cxx b/sw/source/core/text/txtfld.cxx
index 4f39e52..9bbd455 100644
--- a/sw/source/core/text/txtfld.cxx
+++ b/sw/source/core/text/txtfld.cxx
@@ -51,6 +51,7 @@
 #include "reffld.hxx"
 #include "flddat.hxx"
 #include "fmtautofmt.hxx"
+#include <svl/itemiter.hxx>
 
 static bool lcl_IsInBody( SwFrm *pFrm )
 {
@@ -421,7 +422,27 @@ static void checkApplyParagraphMarkFormatToNumbering( SwFont* pNumFnt, SwTxtForm
                 && *hint->GetStart() == *hint->GetEnd() && *hint->GetStart() == node->Len())
             {
                 boost::shared_ptr<SfxItemSet> pSet(hint->GetAutoFmt().GetStyleHandle());
-                pNumFnt->SetDiffFnt( pSet.get(), pIDSA );
+
+                // Check each item and in case it should be ignored, then clear it.
+                boost::shared_ptr<SfxItemSet> pCleanedSet;
+                if (pSet.get())
+                {
+                    pCleanedSet.reset(pSet->Clone());
+
+                    SfxItemIter aIter(*pSet);
+                    const SfxPoolItem* pItem = aIter.GetCurItem();
+                    while (true)
+                    {
+                        if (SwTxtNode::IsIgnoredCharFmtForNumbering(pItem->Which()))
+                            pCleanedSet->ClearItem(pItem->Which());
+
+                        if (aIter.IsAtEnd())
+                            break;
+
+                        pItem = aIter.NextItem();
+                    }
+                }
+                pNumFnt->SetDiffFnt(pCleanedSet.get(), pIDSA);
             }
         }
     }
diff --git a/sw/source/core/txtnode/thints.cxx b/sw/source/core/txtnode/thints.cxx
index f680282..5dc8df8 100644
--- a/sw/source/core/txtnode/thints.cxx
+++ b/sw/source/core/txtnode/thints.cxx
@@ -1763,7 +1763,7 @@ void SwTxtNode::DelSoftHyph( const sal_Int32 nStt, const sal_Int32 nEnd )
 
 bool SwTxtNode::IsIgnoredCharFmtForNumbering(const sal_uInt16 nWhich)
 {
-    return (nWhich ==  RES_CHRATR_UNDERLINE || nWhich == RES_CHRATR_BACKGROUND || nWhich == RES_CHRATR_ESCAPEMENT);
+    return (nWhich ==  RES_CHRATR_UNDERLINE || nWhich == RES_CHRATR_COLOR || nWhich == RES_CHRATR_BACKGROUND || nWhich == RES_CHRATR_ESCAPEMENT);
 }
 
 //In MS Word, following properties of the paragraph end position wont affect the formatting of bullets, so we ignore them:
commit 01c4588fdad04c45d239afb3136b82f72fdd1c80
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Thu Nov 20 09:54:15 2014 +0100

    sw: move IsIgnoredCharFmtForNumbering() to SwTxtNode
    
    I need this in SwTxtFormatter.
    
    (cherry picked from commit 96664bf0152ecf8ee64aa6b22ed399c1866117f1)
    Signed-off-by: Michael Stahl <mstahl at redhat.com>
    
    Conflicts:
    	sw/inc/ndtxt.hxx
    
    Change-Id: Ib1586299f468a88e92fdb367fbab69a683791dc9

diff --git a/sw/inc/ndtxt.hxx b/sw/inc/ndtxt.hxx
index b7af846..72a1a3d 100644
--- a/sw/inc/ndtxt.hxx
+++ b/sw/inc/ndtxt.hxx
@@ -797,6 +797,9 @@ public:
     bool CompareParRsid( const SwTxtNode &rTxtNode ) const;
 
     DECL_FIXEDMEMPOOL_NEWDEL(SwTxtNode)
+
+    /// In MS Word, the font underline setting of the paragraph end position wont affect the formatting of numbering, so we ignore it
+    static bool IsIgnoredCharFmtForNumbering(const sal_uInt16 nWhich);
 };
 
 inline SwpHints & SwTxtNode::GetSwpHints()
diff --git a/sw/source/core/txtnode/thints.cxx b/sw/source/core/txtnode/thints.cxx
index 4932195..f680282 100644
--- a/sw/source/core/txtnode/thints.cxx
+++ b/sw/source/core/txtnode/thints.cxx
@@ -1761,8 +1761,7 @@ void SwTxtNode::DelSoftHyph( const sal_Int32 nStt, const sal_Int32 nEnd )
     }
 }
 
-//In MS Word, the font underline setting of the paragraph end position wont affect the formatting of numbering, so we ignore it
-bool lcl_IsIgnoredCharFmtForNumbering(const sal_uInt16 nWhich)
+bool SwTxtNode::IsIgnoredCharFmtForNumbering(const sal_uInt16 nWhich)
 {
     return (nWhich ==  RES_CHRATR_UNDERLINE || nWhich == RES_CHRATR_BACKGROUND || nWhich == RES_CHRATR_ESCAPEMENT);
 }
@@ -1812,7 +1811,7 @@ bool SwTxtNode::TryCharSetExpandToNum(const SfxItemSet& aCharSet)
         {
             if (pCurrNumFmt->IsItemize() && lcl_IsIgnoredCharFmtForBullets(nWhich))
                 return bRet;
-            if (pCurrNumFmt->IsEnumeration() && lcl_IsIgnoredCharFmtForNumbering(nWhich))
+            if (pCurrNumFmt->IsEnumeration() && SwTxtNode::IsIgnoredCharFmtForNumbering(nWhich))
                 return bRet;
             SwCharFmt* pCurrCharFmt =pCurrNumFmt->GetCharFmt();
 


More information about the Libreoffice-commits mailing list