summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2014-11-20 11:02:45 +0100
committerMiklos Vajna <vmiklos@collabora.co.uk>2014-11-20 11:46:59 +0100
commitb2c1474c1dc93b69f0ede03fc5c9ab496c669955 (patch)
tree7f049ca2cdabad5e0fcf415e39e29f7f07ed3a5d
parent96664bf0152ecf8ee64aa6b22ed399c1866117f1 (diff)
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. Change-Id: I5d8df9b404916cc4a4405bf796d971ede59e6111
-rw-r--r--sw/qa/extras/ooxmlexport/data/num-override-lvltext.docxbin13625 -> 13708 bytes
-rw-r--r--sw/qa/extras/ooxmlexport/ooxmlexport.cxx3
-rw-r--r--sw/source/core/text/txtfld.cxx23
-rw-r--r--sw/source/core/txtnode/thints.cxx2
4 files changed, 26 insertions, 2 deletions
diff --git a/sw/qa/extras/ooxmlexport/data/num-override-lvltext.docx b/sw/qa/extras/ooxmlexport/data/num-override-lvltext.docx
index 5ee36020a112..fe3142d54a03 100644
--- a/sw/qa/extras/ooxmlexport/data/num-override-lvltext.docx
+++ b/sw/qa/extras/ooxmlexport/data/num-override-lvltext.docx
Binary files differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index 8c78d45343fb..519ad65e45f4 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
@@ -596,6 +596,9 @@ DECLARE_OOXMLEXPORT_TEST(testNumOverrideLvltext, "num-override-lvltext.docx")
uno::Reference<container::XIndexAccess> xRules = getProperty< uno::Reference<container::XIndexAccess> >(getStyles("NumberingStyles")->getByName("WWNum1"), "NumberingRules");
// This was 1, i.e. the numbering on the second level was "1", not "1.1".
CPPUNIT_ASSERT_EQUAL(sal_Int16(2), comphelper::SequenceAsHashMap(xRules->getByIndex(1))["ParentNumbering"].get<sal_Int16>());
+
+ // The paragraph marker's red font color was inherited by the number portion, this was ff0000.
+ CPPUNIT_ASSERT_EQUAL(OUString("00000a"), parseDump("//Special[@nType='POR_NUMBER']/pFont", "color"));
}
CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/sw/source/core/text/txtfld.cxx b/sw/source/core/text/txtfld.cxx
index 9c3935336411..f3049fb7c113 100644
--- a/sw/source/core/text/txtfld.cxx
+++ b/sw/source/core/text/txtfld.cxx
@@ -52,6 +52,7 @@
#include "flddat.hxx"
#include "fmtautofmt.hxx"
#include <IDocumentSettingAccess.hxx>
+#include <svl/itemiter.hxx>
static bool lcl_IsInBody( SwFrm *pFrm )
{
@@ -427,7 +428,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 0308eb5c5c24..0e089f35ce90 100644
--- a/sw/source/core/txtnode/thints.cxx
+++ b/sw/source/core/txtnode/thints.cxx
@@ -1781,7 +1781,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: