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

Miklos Vajna vmiklos at collabora.co.uk
Sat Apr 11 13:24:07 PDT 2015


 sw/qa/extras/mailmerge/data/tdf89214.odt |binary
 sw/qa/extras/mailmerge/mailmerge.cxx     |   12 ++++++++++++
 sw/source/core/doc/docnum.cxx            |    6 +++---
 3 files changed, 15 insertions(+), 3 deletions(-)

New commits:
commit 384880cb2e395e359b152c5afe7d8ba56c5249ff
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Thu Apr 9 14:20:44 2015 +0200

    tdf#89214 SwDoc::GetUniqueNumRuleName: always return pChkStr if it's unused
    
    Regression from commit bb00a0097900ae054401f7758a915047cfde4065 (do not
    bother with nice unique names during mailmerge, 2014-11-08),
    SwAttrSet::CopyToModify() expects that in case SwDoc::FindNumRulePtr()
    returns 0 for a name, then the call to SwDoc::MakeNumRule() will use the
    not found name (as SwDoc::GetUniqueNumRuleName() will return the just
    checked name).
    
    As a result, simply always returning a random unique name during mail
    merge is a problem. Only return a cheap random unique name if no hint is
    given.
    
    (cherry picked from commit ceafd0a76fb062237f627cd9d49d4aad78cf3066)
    
    Conflicts:
    	sw/qa/extras/mailmerge/mailmerge.cxx
    
    Change-Id: I49d65009ced97d00aa2e8db35a529f2f30ac9ae5
    Reviewed-on: https://gerrit.libreoffice.org/15229
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/sw/qa/extras/mailmerge/data/tdf89214.odt b/sw/qa/extras/mailmerge/data/tdf89214.odt
new file mode 100644
index 0000000..70def37
Binary files /dev/null and b/sw/qa/extras/mailmerge/data/tdf89214.odt differ
diff --git a/sw/qa/extras/mailmerge/mailmerge.cxx b/sw/qa/extras/mailmerge/mailmerge.cxx
index d17c835..3ac9724 100644
--- a/sw/qa/extras/mailmerge/mailmerge.cxx
+++ b/sw/qa/extras/mailmerge/mailmerge.cxx
@@ -334,6 +334,18 @@ DECLARE_SHELL_MAILMERGE_TEST(testPageBoundaries2Pages, "simple-mail-merge-2pages
     }
 }
 
+DECLARE_SHELL_MAILMERGE_TEST(testTdf89214, "tdf89214.odt", "10-testing-addresses.ods", "testing-addresses")
+{
+    executeMailMerge();
+
+    uno::Reference<text::XTextDocument> xTextDocument(mxMMComponent, uno::UNO_QUERY);
+    uno::Reference<text::XTextRange> xParagraph(getParagraphOrTable(3, xTextDocument->getText()), uno::UNO_QUERY);
+    // Make sure that we assert the right paragraph.
+    CPPUNIT_ASSERT_EQUAL(OUString("a"), xParagraph->getString());
+    // This paragraph had a bullet numbering, make sure that the list id is not empty.
+    CPPUNIT_ASSERT(!getProperty<OUString>(xParagraph, "ListId").isEmpty());
+}
+
 #endif
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/sw/source/core/doc/docnum.cxx b/sw/source/core/doc/docnum.cxx
index 835b1e1..f767f9a 100644
--- a/sw/source/core/doc/docnum.cxx
+++ b/sw/source/core/doc/docnum.cxx
@@ -2188,13 +2188,13 @@ sal_uInt16 SwDoc::MakeNumRule( const OUString &rName,
 
 OUString SwDoc::GetUniqueNumRuleName( const OUString* pChkStr, bool bAutoNum ) const
 {
-    if( IsInMailMerge())
+    // If we got pChkStr, then the caller expects that in case it's not yet
+    // used, it'll be returned.
+    if( IsInMailMerge() && !pChkStr )
     {
         OUString newName = "MailMergeNumRule"
             + OStringToOUString( DateTimeToOString( DateTime( DateTime::SYSTEM )), RTL_TEXTENCODING_ASCII_US )
             + OUString::number( mpNumRuleTbl->size() + 1 );
-        if( pChkStr )
-            newName += *pChkStr;
         return newName;
     }
 


More information about the Libreoffice-commits mailing list