[Libreoffice-commits] core.git: Branch 'libreoffice-4-1' - sw/qa sw/source

Miklos Vajna vmiklos at collabora.co.uk
Wed Mar 5 02:23:32 PST 2014


 sw/qa/extras/ww8import/data/bnc821208.doc |binary
 sw/qa/extras/ww8import/ww8import.cxx      |   11 +++++++++++
 sw/source/filter/ww8/ww8par2.cxx          |    5 +++++
 3 files changed, 16 insertions(+)

New commits:
commit f57fa998035cb5f859b89451a563137fdaf1b465
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Tue Mar 4 14:47:13 2014 +0100

    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.
    
    (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 <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/sw/qa/extras/ww8import/data/bnc821208.doc b/sw/qa/extras/ww8import/data/bnc821208.doc
new file mode 100755
index 0000000..d89d711
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 3311563..4fd9d21 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<float>(getParagraphOfText(1, xText), "CharHeight"));
 }
 
+void Test::testBnc821208()
+{
+    // 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);
+}
+
 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 81841d5..01baf33 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;
 


More information about the Libreoffice-commits mailing list