diff options
author | Oliver Bolte <obo@openoffice.org> | 2004-11-16 15:59:00 +0000 |
---|---|---|
committer | Oliver Bolte <obo@openoffice.org> | 2004-11-16 15:59:00 +0000 |
commit | c9080eb7854c8e9e2d4faabf6fcfa65f822bf23c (patch) | |
tree | 57e341110cea27bf4e2b10114e65dafa70565536 /sw/source/ui | |
parent | 5593e1fe9c96b3e452ba340011dba8007db8948f (diff) |
INTEGRATION: CWS iha04 (1.3.70); FILE MERGED
2004/10/26 17:45:02 iha 1.3.70.1: #i34738# fix country settings
Diffstat (limited to 'sw/source/ui')
-rw-r--r-- | sw/source/ui/dbui/mmlayoutpage.cxx | 57 |
1 files changed, 33 insertions, 24 deletions
diff --git a/sw/source/ui/dbui/mmlayoutpage.cxx b/sw/source/ui/dbui/mmlayoutpage.cxx index d2e7882fcb17..53f69259cbce 100644 --- a/sw/source/ui/dbui/mmlayoutpage.cxx +++ b/sw/source/ui/dbui/mmlayoutpage.cxx @@ -2,9 +2,9 @@ * * $RCSfile: mmlayoutpage.cxx,v $ * - * $Revision: 1.3 $ + * $Revision: 1.4 $ * - * last change: $Author: rt $ $Date: 2004-09-29 09:31:31 $ + * last change: $Author: obo $ $Date: 2004-11-16 16:59:00 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -439,7 +439,9 @@ SwFrmFmt* SwMailMergeLayoutPage::InsertAddressFrame( // paragraph has to be hidden depending on the // IsIncludeCountry()/GetExcludeCountry() settings - bool bContainsCountryOnly = true; + sal_Bool bIncludeCountry = rConfigItem.IsIncludeCountry(); + const ::rtl::OUString rExcludeCountry = rConfigItem.GetExcludeCountry(); + bool bSpecialReplacementForCountry = (!bIncludeCountry || rExcludeCountry.getLength()); const ResStringArray& rHeaders = rConfigItem.GetDefaultAddressHeaders(); String sCountryColumn = rHeaders.GetString(MM_PART_COUNTRY); @@ -469,40 +471,47 @@ SwFrmFmt* SwMailMergeLayoutPage::InsertAddressFrame( } String sDB(sDBName); sDB += sConvertedColumn; - bContainsCountryOnly &= TRUE == (aItem.sText == sCountryColumn); - SwInsertFld_Data aData(TYP_DBFLD, 0, sDB, aEmptyStr, 0, &rShell ); - aFldMgr.InsertFld( aData ); - } - else if(!aItem.bIsReturn) - { - rShell.Insert(aItem.sText); - } - else - { - sal_Bool bIncludeCountry = rConfigItem.IsIncludeCountry(); - const ::rtl::OUString rCountry = rConfigItem.GetExcludeCountry(); - if( bContainsCountryOnly && (!bIncludeCountry || rCountry.getLength())) + + if( bSpecialReplacementForCountry && sCountryColumn == sConvertedColumn ) { // now insert a hidden paragraph field String sExpression; - if(!bIncludeCountry) - sExpression = String::CreateFromAscii("true"); - else + if( rExcludeCountry.getLength() ) { sCountryColumnBase.SearchAndReplaceAll(DB_DELIM, '.'); sExpression = sCountryColumnBase; sExpression.Insert('[', 0); sExpression += sCountryColumn; - sExpression.AppendAscii("] == \""); - sExpression += String(rCountry); - sExpression += '\"'; + sExpression.AppendAscii("]"); + + String sCondition(sExpression); + sCondition.AppendAscii(" != \""); + sCondition += String(rExcludeCountry); + sCondition += '\"'; + + SwInsertFld_Data aData(TYP_CONDTXTFLD, 0, sCondition, sExpression, 0, &rShell ); + aFldMgr.InsertFld( aData ); } - SwInsertFld_Data aData(TYP_HIDDENPARAFLD, 0, sExpression, aEmptyStr, 0, &rShell ); + else + { + SwInsertFld_Data aData(TYP_HIDDENPARAFLD, 0, sExpression, aEmptyStr, 0, &rShell ); + aFldMgr.InsertFld( aData ); + } + } + else + { + SwInsertFld_Data aData(TYP_DBFLD, 0, sDB, aEmptyStr, 0, &rShell ); aFldMgr.InsertFld( aData ); } + } + else if(!aItem.bIsReturn) + { + rShell.Insert(aItem.sText); + } + else + { //now add a new paragraph rShell.SplitNode(); - bContainsCountryOnly = true; } } } |