summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
Diffstat (limited to 'sw')
-rw-r--r--sw/inc/doc.hxx4
-rw-r--r--sw/source/core/doc/doclay.cxx2
-rw-r--r--sw/source/core/doc/docnew.cxx1
-rw-r--r--sw/source/ui/dbui/dbmgr.cxx8
4 files changed, 14 insertions, 1 deletions
diff --git a/sw/inc/doc.hxx b/sw/inc/doc.hxx
index 86aae2817d6c..c7d7af8de5ef 100644
--- a/sw/inc/doc.hxx
+++ b/sw/inc/doc.hxx
@@ -436,6 +436,7 @@ private:
bool mbCopyIsMove : 1; ///< TRUE: Copy is a hidden Move.
bool mbVisibleLinks : 1; ///< TRUE: Links are inserted visibly.
bool mbInReading : 1; ///< TRUE: Document is in the process of being read.
+ bool mbInMailMerge : 1; //< TRUE: Document is in the process of being written by mail merge.
bool mbInXMLImport : 1; ///< TRUE: During xml import, attribute portion building is not necessary.
bool mbUpdateTOX : 1; ///< TRUE: After loading document, update TOX.
bool mbInLoadAsynchron : 1; ///< TRUE: Document is in the process of being loaded asynchronously.
@@ -1428,6 +1429,9 @@ public:
bool IsInReading() const { return mbInReading; }
void SetInReading( bool bNew ) { mbInReading = bNew; }
+ bool IsInMailMerge() const { return mbInMailMerge; }
+ void SetInMailMerge( bool bNew ) { mbInMailMerge = bNew; }
+
bool IsClipBoard() const { return mbClipBoard; }
/// N.B.: must be called right after constructor! (@see GetXmlIdRegistry)
void SetClipBoard( bool bNew ) { mbClipBoard = bNew; }
diff --git a/sw/source/core/doc/doclay.cxx b/sw/source/core/doc/doclay.cxx
index 3097633a3aff..2da20a1546d4 100644
--- a/sw/source/core/doc/doclay.cxx
+++ b/sw/source/core/doc/doclay.cxx
@@ -411,7 +411,7 @@ SwFrmFmt *SwDoc::CopyLayoutFmt( const SwFrmFmt& rSource,
if( !mbCopyIsMove || this != pSrcDoc )
{
- if( mbInReading )
+ if( mbInReading || IsInMailMerge())
pDest->SetName( aEmptyStr );
else
{
diff --git a/sw/source/core/doc/docnew.cxx b/sw/source/core/doc/docnew.cxx
index 112bdf59a62b..bd24134527a2 100644
--- a/sw/source/core/doc/docnew.cxx
+++ b/sw/source/core/doc/docnew.cxx
@@ -259,6 +259,7 @@ SwDoc::SwDoc()
mbCopyIsMove(false),
mbVisibleLinks(true),
mbInReading(false),
+ mbInMailMerge(false),
mbInXMLImport(false),
mbUpdateTOX(false),
mbInLoadAsynchron(false),
diff --git a/sw/source/ui/dbui/dbmgr.cxx b/sw/source/ui/dbui/dbmgr.cxx
index 62d607f0b89a..9685b3ba495d 100644
--- a/sw/source/ui/dbui/dbmgr.cxx
+++ b/sw/source/ui/dbui/dbmgr.cxx
@@ -1024,6 +1024,7 @@ sal_Bool SwNewDBMgr::MergeMailFiles(SwWrtShell* pSourceShell,
pTargetView->AttrChangedNotify( &pTargetView->GetWrtShell() );
pTargetShell = pTargetView->GetWrtShellPtr();
pTargetDoc = pTargetShell->GetDoc();
+ pTargetDoc->SetInMailMerge(true);
//copy the styles from the source to the target document
pTargetView->GetDocShell()->_LoadStyles( *pSourceDocSh, sal_True );
@@ -1357,6 +1358,13 @@ sal_Bool SwNewDBMgr::MergeMailFiles(SwWrtShell* pSourceShell,
}
} while( !bCancel &&
(bSynchronizedDoc && (nStartRow != nEndRow)? ExistsNextRecord() : ToNextMergeRecord()));
+ if (rMergeDescriptor.bCreateSingleFile)
+ {
+ // sw::DocumentLayoutManager::CopyLayoutFmt() did not generate
+ // unique fly names, do it here once.
+ pTargetDoc->SetInMailMerge(false);
+ pTargetDoc->SetAllUniqueFlyNames();
+ }
for( sal_uInt16 i = 0; i < 25; i++)
Application::Reschedule();