summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2014-03-04 14:47:13 +0100
committerCaolán McNamara <caolanm@redhat.com>2014-03-05 04:23:08 -0600
commit4b7d584b13a40a6e067afdacb77638b334606da2 (patch)
treec747ea8f9374901c894dd9b82e412eb58fc84872 /sw
parent4cb3765cccd22cb127a263be4125470466c65467 (diff)
bnc#821208 DOC import: don't overwrite WW8Num* character styles
In general we're overwriting styles on import in case we're not pasting. But these WW8Num* character styles are in general not from the document, they are created because Writer needs a character style for each numbering level to handle what's in the DOC file. So, in case there is a character style with the same name as our "character style for numbering" styles, prefer the later ones, as that's intended most likely. Change-Id: I675f867722360aca765bb96b0b43ea47deab9847 (cherry picked from commit e88ee8aa307ecec1cc22cda56b97dcfd8b838ce8) Reviewed-on: https://gerrit.libreoffice.org/8448 Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sw')
-rwxr-xr-xsw/qa/extras/ww8import/data/bnc821208.docbin0 -> 30208 bytes
-rw-r--r--sw/qa/extras/ww8import/ww8import.cxx9
-rw-r--r--sw/source/filter/ww8/ww8par2.cxx5
3 files changed, 14 insertions, 0 deletions
diff --git a/sw/qa/extras/ww8import/data/bnc821208.doc b/sw/qa/extras/ww8import/data/bnc821208.doc
new file mode 100755
index 000000000000..d89d711f38be
--- /dev/null
+++ b/sw/qa/extras/ww8import/data/bnc821208.doc
Binary files differ
diff --git a/sw/qa/extras/ww8import/ww8import.cxx b/sw/qa/extras/ww8import/ww8import.cxx
index 0c3e1fcb26e9..cc107e041ead 100644
--- a/sw/qa/extras/ww8import/ww8import.cxx
+++ b/sw/qa/extras/ww8import/ww8import.cxx
@@ -234,6 +234,15 @@ DECLARE_WW8IMPORT_TEST(testListNolevel, "list-nolevel.doc")
CPPUNIT_ASSERT_EQUAL(OUString("1."), aText);
}
+DECLARE_WW8IMPORT_TEST(testBnc821208, "bnc821208.doc")
+{
+ // WW8Num1z0 earned a Symbol font, turning numbers into rectangles.
+ uno::Reference<beans::XPropertyState> xPropertyState(getStyles("CharacterStyles")->getByName("WW8Num1z0"), uno::UNO_QUERY);
+ beans::PropertyState ePropertyState = xPropertyState->getPropertyState("CharFontName");
+ // This was beans::PropertyState_DIRECT_VALUE.
+ CPPUNIT_ASSERT_EQUAL(beans::PropertyState_DEFAULT_VALUE, ePropertyState);
+}
+
#endif
CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/sw/source/filter/ww8/ww8par2.cxx b/sw/source/filter/ww8/ww8par2.cxx
index 4d454e14c0d6..f94e0553d70a 100644
--- a/sw/source/filter/ww8/ww8par2.cxx
+++ b/sw/source/filter/ww8/ww8par2.cxx
@@ -3750,6 +3750,11 @@ bool WW8RStyle::PrepareStyle(SwWW8StyInf &rSI, ww::sti eSti, sal_uInt16 nThisSty
}
bool bImport = !bStyExist || pIo->mbNewDoc; // import content ?
+
+ // Do not override character styles the list import code created earlier.
+ if (bImport && bStyExist && rSI.GetOrgWWName().startsWith("WW8Num"))
+ bImport = false;
+
bool bOldNoImp = pIo->bNoAttrImport;
rSI.bImportSkipped = !bImport;