diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2015-04-09 14:20:44 +0200 |
---|---|---|
committer | Jan Holesovsky <kendy@collabora.com> | 2015-04-09 19:09:42 +0200 |
commit | 813ee98ed511fd8ce13d1bee4c84c18076ed66e1 (patch) | |
tree | fb7520a4e4f05ef44358b532eaa21614285da429 | |
parent | 3bb49e8dfb8cc82fbb9c6780eae0754913a6e558 (diff) |
tdf#89214 SwDoc::GetUniqueNumRuleName: always return pChkStr if it's unusedprivate/kendy/mailmerge-04
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.
Unit test not backported, as the framework is missing in the 4.1-LHM.
Conflicts:
sw/qa/extras/mailmerge/mailmerge.cxx
Change-Id: I49d65009ced97d00aa2e8db35a529f2f30ac9ae5
-rw-r--r-- | sw/source/core/doc/docnum.cxx | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/sw/source/core/doc/docnum.cxx b/sw/source/core/doc/docnum.cxx index 3eb149031dad..f8de87a8b792 100644 --- a/sw/source/core/doc/docnum.cxx +++ b/sw/source/core/doc/docnum.cxx @@ -2216,13 +2216,13 @@ sal_uInt16 SwDoc::MakeNumRule( const String &rName, String SwDoc::GetUniqueNumRuleName( const String* 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; } String aName; |