Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
core
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
LibreOffice
core
Commits
dab78653
Kaydet (Commit)
dab78653
authored
Nis 05, 2014
tarafından
Matteo Casalin
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
OUString: constify and avoid concatenated appends
Change-Id: I1bef9af92107d4cb4ac869dd0f6cbd2853302330
üst
7493a4ad
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
40 additions
and
66 deletions
+40
-66
mmlayoutpage.cxx
sw/source/ui/dbui/mmlayoutpage.cxx
+40
-66
No files found.
sw/source/ui/dbui/mmlayoutpage.cxx
Dosyayı görüntüle @
dab78653
...
@@ -114,7 +114,7 @@ SwMailMergeLayoutPage::SwMailMergeLayoutPage( SwMailMergeWizard* _pParent) :
...
@@ -114,7 +114,7 @@ SwMailMergeLayoutPage::SwMailMergeLayoutPage( SwMailMergeWizard* _pParent) :
uno
::
Sequence
<
beans
::
PropertyValue
>
aValues
(
1
);
uno
::
Sequence
<
beans
::
PropertyValue
>
aValues
(
1
);
beans
::
PropertyValue
*
pValues
=
aValues
.
getArray
();
beans
::
PropertyValue
*
pValues
=
aValues
.
getArray
();
pValues
[
0
].
Name
=
"FilterName"
;
pValues
[
0
].
Name
=
"FilterName"
;
pValues
[
0
].
Value
<<=
OUString
(
pSfxFlt
->
GetFilterName
()
);
pValues
[
0
].
Value
<<=
pSfxFlt
->
GetFilterName
(
);
uno
::
Reference
<
frame
::
XStorable
>
xStore
(
pView
->
GetDocShell
()
->
GetModel
(),
uno
::
UNO_QUERY
);
uno
::
Reference
<
frame
::
XStorable
>
xStore
(
pView
->
GetDocShell
()
->
GetModel
(),
uno
::
UNO_QUERY
);
xStore
->
storeToURL
(
m_sExampleURL
,
aValues
);
xStore
->
storeToURL
(
m_sExampleURL
,
aValues
);
...
@@ -302,14 +302,10 @@ SwFrmFmt* SwMailMergeLayoutPage::InsertAddressFrame(
...
@@ -302,14 +302,10 @@ SwFrmFmt* SwMailMergeLayoutPage::InsertAddressFrame(
SwFldMgr
aFldMgr
(
&
rShell
);
SwFldMgr
aFldMgr
(
&
rShell
);
//create a database string source.command.commandtype.column
//create a database string source.command.commandtype.column
const
SwDBData
&
rData
=
rConfigItem
.
GetCurrentDBData
();
const
SwDBData
&
rData
=
rConfigItem
.
GetCurrentDBData
();
OUString
sDBName
(
rData
.
sDataSource
);
OUString
sDBName
(
rData
.
sDataSource
+
OUString
(
DB_DELIM
)
sDBName
+=
OUString
(
DB_DELIM
);
+
rData
.
sCommand
+
OUString
(
DB_DELIM
));
sDBName
+=
rData
.
sCommand
;
const
OUString
sDatabaseConditionPrefix
(
sDBName
.
replace
(
DB_DELIM
,
'.'
));
sDBName
+=
OUString
(
DB_DELIM
);
sDBName
+=
OUString
::
number
(
rData
.
nCommandType
)
+
OUString
(
DB_DELIM
);
OUString
sDatabaseConditionPrefix
(
sDBName
);
sDatabaseConditionPrefix
=
sDatabaseConditionPrefix
.
replace
(
DB_DELIM
,
'.'
);
sDBName
+=
OUString
::
number
(
rData
.
nCommandType
);
sDBName
+=
OUString
(
DB_DELIM
);
// if only the country is in an address line the
// if only the country is in an address line the
// paragraph has to be hidden depending on the
// paragraph has to be hidden depending on the
...
@@ -321,12 +317,13 @@ SwFrmFmt* SwMailMergeLayoutPage::InsertAddressFrame(
...
@@ -321,12 +317,13 @@ SwFrmFmt* SwMailMergeLayoutPage::InsertAddressFrame(
bool
bSpecialReplacementForCountry
=
(
!
bIncludeCountry
||
!
rExcludeCountry
.
isEmpty
());
bool
bSpecialReplacementForCountry
=
(
!
bIncludeCountry
||
!
rExcludeCountry
.
isEmpty
());
const
ResStringArray
&
rHeaders
=
rConfigItem
.
GetDefaultAddressHeaders
();
const
ResStringArray
&
rHeaders
=
rConfigItem
.
GetDefaultAddressHeaders
();
OUString
sCountryColumn
=
rHeaders
.
GetString
(
MM_PART_COUNTRY
);
Sequence
<
OUString
>
aAssignment
=
Sequence
<
OUString
>
aAssignment
=
rConfigItem
.
GetColumnAssignment
(
rConfigItem
.
GetCurrentDBData
()
);
rConfigItem
.
GetColumnAssignment
(
rConfigItem
.
GetCurrentDBData
()
);
const
OUString
*
pAssignment
=
aAssignment
.
getConstArray
();
const
OUString
*
pAssignment
=
aAssignment
.
getConstArray
();
if
(
aAssignment
.
getLength
()
>
MM_PART_COUNTRY
&&
!
aAssignment
[
MM_PART_COUNTRY
].
isEmpty
())
const
OUString
sCountryColumn
(
sCountryColumn
=
aAssignment
[
MM_PART_COUNTRY
];
(
aAssignment
.
getLength
()
>
MM_PART_COUNTRY
&&
!
aAssignment
[
MM_PART_COUNTRY
].
isEmpty
())
?
aAssignment
[
MM_PART_COUNTRY
]
:
rHeaders
.
GetString
(
MM_PART_COUNTRY
));
OUString
sHideParagraphsExpression
;
OUString
sHideParagraphsExpression
;
SwAddressIterator
aIter
(
aBlocks
[
0
]);
SwAddressIterator
aIter
(
aBlocks
[
0
]);
...
@@ -348,8 +345,7 @@ SwFrmFmt* SwMailMergeLayoutPage::InsertAddressFrame(
...
@@ -348,8 +345,7 @@ SwFrmFmt* SwMailMergeLayoutPage::InsertAddressFrame(
break
;
break
;
}
}
}
}
OUString
sDB
(
sDBName
);
const
OUString
sDB
(
sDBName
+
sConvertedColumn
);
sDB
+=
sConvertedColumn
;
if
(
!
sHideParagraphsExpression
.
isEmpty
())
if
(
!
sHideParagraphsExpression
.
isEmpty
())
sHideParagraphsExpression
+=
" AND "
;
sHideParagraphsExpression
+=
" AND "
;
...
@@ -358,19 +354,18 @@ SwFrmFmt* SwMailMergeLayoutPage::InsertAddressFrame(
...
@@ -358,19 +354,18 @@ SwFrmFmt* SwMailMergeLayoutPage::InsertAddressFrame(
if
(
bSpecialReplacementForCountry
&&
sCountryColumn
==
sConvertedColumn
)
if
(
bSpecialReplacementForCountry
&&
sCountryColumn
==
sConvertedColumn
)
{
{
// now insert a hidden paragraph field
// now insert a hidden paragraph field
OUString
sExpression
;
if
(
!
rExcludeCountry
.
isEmpty
()
)
if
(
!
rExcludeCountry
.
isEmpty
()
)
{
{
sExpression
=
"["
+
sDatabaseConditionPrefix
+
sCountryColumn
+
"]"
;
const
OUString
sExpression
(
"["
+
sDatabaseConditionPrefix
+
sCountryColumn
+
"]"
)
;
SwInsertFld_Data
aData
(
TYP_CONDTXTFLD
,
0
,
OUString
sCondition
=
sExpression
+
" !=
\"
"
+
rExcludeCountry
+
"
\"
"
;
sExpression
+
" !=
\"
"
+
rExcludeCountry
+
"
\"
"
,
sExpression
,
SwInsertFld_Data
aData
(
TYP_CONDTXTFLD
,
0
,
sCondition
,
sExpression
,
0
,
&
rShell
);
0
,
&
rShell
);
aFldMgr
.
InsertFld
(
aData
);
aFldMgr
.
InsertFld
(
aData
);
}
}
else
else
{
{
SwInsertFld_Data
aData
(
TYP_HIDDENPARAFLD
,
0
,
sExpression
,
aEmptyOUStr
,
0
,
&
rShell
);
SwInsertFld_Data
aData
(
TYP_HIDDENPARAFLD
,
0
,
""
,
""
,
0
,
&
rShell
);
aFldMgr
.
InsertFld
(
aData
);
aFldMgr
.
InsertFld
(
aData
);
}
}
}
}
...
@@ -462,7 +457,6 @@ void SwMailMergeLayoutPage::InsertGreeting(SwWrtShell& rShell, SwMailMergeConfig
...
@@ -462,7 +457,6 @@ void SwMailMergeLayoutPage::InsertGreeting(SwWrtShell& rShell, SwMailMergeConfig
}
}
//now insert the greeting text - if we have any?
//now insert the greeting text - if we have any?
const
sal_Bool
bIndividual
=
rConfigItem
.
IsIndividualGreeting
(
sal_False
);
const
sal_Bool
bIndividual
=
rConfigItem
.
IsIndividualGreeting
(
sal_False
);
OUString
sGreeting
;
if
(
bIndividual
)
if
(
bIndividual
)
{
{
//lock expression fields - prevents hiding of the paragraph to insert into
//lock expression fields - prevents hiding of the paragraph to insert into
...
@@ -477,8 +471,8 @@ void SwMailMergeLayoutPage::InsertGreeting(SwWrtShell& rShell, SwMailMergeConfig
...
@@ -477,8 +471,8 @@ void SwMailMergeLayoutPage::InsertGreeting(SwWrtShell& rShell, SwMailMergeConfig
sal_Int32
nCurrent
=
rConfigItem
.
GetCurrentGreeting
((
SwMailMergeConfigItem
::
Gender
)
eGender
);
sal_Int32
nCurrent
=
rConfigItem
.
GetCurrentGreeting
((
SwMailMergeConfigItem
::
Gender
)
eGender
);
if
(
nCurrent
>=
0
&&
nCurrent
<
aEntries
.
getLength
())
if
(
nCurrent
>=
0
&&
nCurrent
<
aEntries
.
getLength
())
{
{
sGreeting
=
aEntries
[
nCurrent
];
// Greeting
rShell
.
Insert
(
sGreeting
);
rShell
.
Insert
(
aEntries
[
nCurrent
]
);
break
;
break
;
}
}
}
}
...
@@ -490,33 +484,19 @@ void SwMailMergeLayoutPage::InsertGreeting(SwWrtShell& rShell, SwMailMergeConfig
...
@@ -490,33 +484,19 @@ void SwMailMergeLayoutPage::InsertGreeting(SwWrtShell& rShell, SwMailMergeConfig
//are to be inserted
//are to be inserted
//name of the gender column
//name of the gender column
OUString
sGenderColumn
=
rConfigItem
.
GetAssignedColumn
(
MM_PART_GENDER
);
const
OUString
sGenderColumn
=
rConfigItem
.
GetAssignedColumn
(
MM_PART_GENDER
);
OUString
sNameColumn
=
rConfigItem
.
GetAssignedColumn
(
MM_PART_LASTNAME
);
const
OUString
sNameColumn
=
rConfigItem
.
GetAssignedColumn
(
MM_PART_LASTNAME
);
const
OUString
&
rFemaleGenderValue
=
rConfigItem
.
GetFemaleGenderValue
();
const
OUString
&
rFemaleGenderValue
=
rConfigItem
.
GetFemaleGenderValue
();
sal_Bool
bHideEmptyParagraphs
=
rConfigItem
.
IsHideEmptyParagraphs
();
sal_Bool
bHideEmptyParagraphs
=
rConfigItem
.
IsHideEmptyParagraphs
();
const
SwDBData
&
rData
=
rConfigItem
.
GetCurrentDBData
();
const
SwDBData
&
rData
=
rConfigItem
.
GetCurrentDBData
();
OUString
sConditionBase
(
rData
.
sDataSource
);
const
OUString
sCommonBase
(
rData
.
sDataSource
+
"."
+
rData
.
sCommand
+
"."
);
sConditionBase
+=
"."
;
const
OUString
sConditionBase
(
"["
+
sCommonBase
+
sGenderColumn
+
"]"
);
sConditionBase
+=
rData
.
sCommand
;
const
OUString
sNameColumnBase
(
"["
+
sCommonBase
+
sNameColumn
+
"]"
);
sConditionBase
+=
"."
;
//split the name column from here
const
OUString
sDBName
(
rData
.
sDataSource
+
OUString
(
DB_DELIM
)
OUString
sNameColumnBase
(
sConditionBase
);
+
rData
.
sCommand
+
OUString
(
DB_DELIM
)
+
OUString
::
number
(
rData
.
nCommandType
)
+
OUString
(
DB_DELIM
));
sConditionBase
+=
sGenderColumn
;
sConditionBase
+=
"]"
;
sConditionBase
=
"["
+
sConditionBase
;
sNameColumnBase
+=
sNameColumn
;
sNameColumnBase
+=
"]"
;
sNameColumnBase
=
"["
+
sNameColumnBase
;
OUString
sDBName
(
rData
.
sDataSource
);
sDBName
+=
OUString
(
DB_DELIM
);
sDBName
+=
rData
.
sCommand
;
sDBName
+=
OUString
(
DB_DELIM
);
sDBName
+=
OUString
::
number
(
rData
.
nCommandType
);
sDBName
+=
OUString
(
DB_DELIM
);
// Female: [database.sGenderColumn] != "rFemaleGenderValue" && [database.NameColumn]
// Female: [database.sGenderColumn] != "rFemaleGenderValue" && [database.NameColumn]
// Male: [database.sGenderColumn] == "rFemaleGenderValue" && [database.rGenderColumn]
// Male: [database.sGenderColumn] == "rFemaleGenderValue" && [database.rGenderColumn]
...
@@ -531,25 +511,19 @@ void SwMailMergeLayoutPage::InsertGreeting(SwWrtShell& rShell, SwMailMergeConfig
...
@@ -531,25 +511,19 @@ void SwMailMergeLayoutPage::InsertGreeting(SwWrtShell& rShell, SwMailMergeConfig
sal_Int32
nCurrent
=
rConfigItem
.
GetCurrentGreeting
((
SwMailMergeConfigItem
::
Gender
)
eGender
);
sal_Int32
nCurrent
=
rConfigItem
.
GetCurrentGreeting
((
SwMailMergeConfigItem
::
Gender
)
eGender
);
if
(
nCurrent
>=
0
&&
nCurrent
<
aEntries
.
getLength
())
if
(
nCurrent
>=
0
&&
nCurrent
<
aEntries
.
getLength
())
{
{
sGreeting
=
aEntries
[
nCurrent
];
const
OUString
sGreeting
=
aEntries
[
nCurrent
];
OUString
sCondition
(
sConditionBase
)
;
OUString
sCondition
;
OUString
sHideParagraphsExpression
;
OUString
sHideParagraphsExpression
;
switch
(
eGender
)
switch
(
eGender
)
{
{
case
SwMailMergeConfigItem
:
:
FEMALE
:
case
SwMailMergeConfigItem
:
:
FEMALE
:
sCondition
+=
" !=
\"
"
;
sCondition
=
sConditionBase
+
" !=
\"
"
+
rFemaleGenderValue
sCondition
+=
rFemaleGenderValue
;
+
"
\"
OR NOT "
+
sNameColumnBase
;
sCondition
+=
"
\"
OR NOT "
;
sHideParagraphsExpression
=
"!"
+
sNameColumnBase
;
sCondition
+=
sNameColumnBase
;
sHideParagraphsExpression
+=
"!"
;
sHideParagraphsExpression
+=
sNameColumnBase
;
break
;
break
;
case
SwMailMergeConfigItem
:
:
MALE
:
case
SwMailMergeConfigItem
:
:
MALE
:
sCondition
+=
" ==
\"
"
;
sCondition
=
sConditionBase
+
" ==
\"
"
+
rFemaleGenderValue
sCondition
+=
rFemaleGenderValue
;
+
"
\"
OR NOT "
+
sNameColumnBase
;
sCondition
+=
"
\"
OR NOT "
;
sCondition
+=
sNameColumnBase
;
break
;
break
;
case
SwMailMergeConfigItem
:
:
NEUTRAL
:
case
SwMailMergeConfigItem
:
:
NEUTRAL
:
sCondition
=
sNameColumnBase
;
sCondition
=
sNameColumnBase
;
...
@@ -578,7 +552,6 @@ void SwMailMergeLayoutPage::InsertGreeting(SwWrtShell& rShell, SwMailMergeConfig
...
@@ -578,7 +552,6 @@ void SwMailMergeLayoutPage::InsertGreeting(SwWrtShell& rShell, SwMailMergeConfig
SwMergeAddressItem
aItem
=
aIter
.
Next
();
SwMergeAddressItem
aItem
=
aIter
.
Next
();
if
(
aItem
.
bIsColumn
)
if
(
aItem
.
bIsColumn
)
{
{
OUString
sDB
(
sDBName
);
OUString
sConvertedColumn
=
aItem
.
sText
;
OUString
sConvertedColumn
=
aItem
.
sText
;
for
(
sal_uInt32
nColumn
=
0
;
for
(
sal_uInt32
nColumn
=
0
;
nColumn
<
rHeaders
.
Count
()
&&
nColumn
<
rHeaders
.
Count
()
&&
...
@@ -592,8 +565,9 @@ void SwMailMergeLayoutPage::InsertGreeting(SwWrtShell& rShell, SwMailMergeConfig
...
@@ -592,8 +565,9 @@ void SwMailMergeLayoutPage::InsertGreeting(SwWrtShell& rShell, SwMailMergeConfig
break
;
break
;
}
}
}
}
sDB
+=
sConvertedColumn
;
SwInsertFld_Data
aData
(
TYP_DBFLD
,
0
,
SwInsertFld_Data
aData
(
TYP_DBFLD
,
0
,
sDB
,
aEmptyOUStr
,
0
,
&
rShell
);
sDBName
+
sConvertedColumn
,
aEmptyOUStr
,
0
,
&
rShell
);
aFldMgr
.
InsertFld
(
aData
);
aFldMgr
.
InsertFld
(
aData
);
}
}
else
else
...
@@ -613,9 +587,9 @@ void SwMailMergeLayoutPage::InsertGreeting(SwWrtShell& rShell, SwMailMergeConfig
...
@@ -613,9 +587,9 @@ void SwMailMergeLayoutPage::InsertGreeting(SwWrtShell& rShell, SwMailMergeConfig
{
{
Sequence
<
OUString
>
aEntries
=
rConfigItem
.
GetGreetings
(
SwMailMergeConfigItem
::
NEUTRAL
);
Sequence
<
OUString
>
aEntries
=
rConfigItem
.
GetGreetings
(
SwMailMergeConfigItem
::
NEUTRAL
);
sal_Int32
nCurrent
=
rConfigItem
.
GetCurrentGreeting
(
SwMailMergeConfigItem
::
NEUTRAL
);
sal_Int32
nCurrent
=
rConfigItem
.
GetCurrentGreeting
(
SwMailMergeConfigItem
::
NEUTRAL
);
if
(
nCurrent
>=
0
&&
nCurrent
<
aEntries
.
getLength
())
// Greeting
sGreeting
=
aEntries
[
nCurrent
];
rShell
.
Insert
((
nCurrent
>=
0
&&
nCurrent
<
aEntries
.
getLength
()
)
rShell
.
Insert
(
sGreeting
);
?
aEntries
[
nCurrent
]
:
OUString
()
);
}
}
// now insert a new paragraph here if necessary
// now insert a new paragraph here if necessary
if
(
bSplitNode
)
if
(
bSplitNode
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment