summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2014-11-20 11:02:45 +0100
committerMichael Stahl <mstahl@redhat.com>2015-01-09 22:02:56 +0100
commit54eb3d31b7be999468f1ae54a99730a8c739a22d (patch)
tree097258058bf6bba8de5ebb5ec7921cd6d8e9a565
parentsw: move IsIgnoredCharFmtForNumbering() to SwTxtNode (diff)
downloadcore-54eb3d31b7be999468f1ae54a99730a8c739a22d.tar.gz
core-54eb3d31b7be999468f1ae54a99730a8c739a22d.zip
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@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
-rw-r--r--sw/source/core/text/txtfld.cxx23
-rw-r--r--sw/source/core/txtnode/thints.cxx2
2 files changed, 23 insertions, 2 deletions
diff --git a/sw/source/core/text/txtfld.cxx b/sw/source/core/text/txtfld.cxx
index 4f39e5269ae4..9bbd4558e42b 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 f68028279cc2..5dc8df8c4d03 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: