From f57fa998035cb5f859b89451a563137fdaf1b465 Mon Sep 17 00:00:00 2001 From: Miklos Vajna Date: Tue, 4 Mar 2014 14:47:13 +0100 Subject: bnc#821208 DOC import: don't overwrite WW8Num* character styles MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. (cherry picked from commit e88ee8aa307ecec1cc22cda56b97dcfd8b838ce8) Conflicts: sw/qa/extras/ww8import/ww8import.cxx Change-Id: I675f867722360aca765bb96b0b43ea47deab9847 Reviewed-on: https://gerrit.libreoffice.org/8449 Reviewed-by: Caolán McNamara Tested-by: Caolán McNamara --- sw/qa/extras/ww8import/data/bnc821208.doc | Bin 0 -> 30208 bytes sw/qa/extras/ww8import/ww8import.cxx | 11 +++++++++++ sw/source/filter/ww8/ww8par2.cxx | 5 +++++ 3 files changed, 16 insertions(+) create mode 100755 sw/qa/extras/ww8import/data/bnc821208.doc 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 Binary files /dev/null and b/sw/qa/extras/ww8import/data/bnc821208.doc differ diff --git a/sw/qa/extras/ww8import/ww8import.cxx b/sw/qa/extras/ww8import/ww8import.cxx index 3311563a5ec3..4fd9d215a711 100644 --- a/sw/qa/extras/ww8import/ww8import.cxx +++ b/sw/qa/extras/ww8import/ww8import.cxx @@ -35,6 +35,7 @@ public: void testN816593(); void testPageBorder(); void testN823651(); + void testBnc821208(); CPPUNIT_TEST_SUITE(Test); #if !defined(MACOSX) && !defined(WNT) @@ -61,6 +62,7 @@ void Test::run() {"n816593.doc", &Test::testN816593}, {"page-border.doc", &Test::testPageBorder}, {"n823651.doc", &Test::testN823651}, + {"bnc821208.doc", &Test::testBnc821208}, }; header(); for (unsigned int i = 0; i < SAL_N_ELEMENTS(aMethods); ++i) @@ -265,6 +267,15 @@ void Test::testN823651() CPPUNIT_ASSERT_EQUAL(7.5f, getProperty(getParagraphOfText(1, xText), "CharHeight")); } +void Test::testBnc821208() +{ + // WW8Num1z0 earned a Symbol font, turning numbers into rectangles. + uno::Reference 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); +} + CPPUNIT_TEST_SUITE_REGISTRATION(Test); CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sw/source/filter/ww8/ww8par2.cxx b/sw/source/filter/ww8/ww8par2.cxx index 81841d556083..01baf330889e 100644 --- a/sw/source/filter/ww8/ww8par2.cxx +++ b/sw/source/filter/ww8/ww8par2.cxx @@ -3763,6 +3763,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().SearchAscii("WW8Num") == 0) + bImport = false; + bool bOldNoImp = pIo->bNoAttrImport; rSI.bImportSkipped = !bImport; -- cgit v1.2.3