summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan-Marek Glogowski <glogow@fbihome.de>2014-06-27 14:58:24 +0200
committerJan-Marek Glogowski <glogow@fbihome.de>2014-09-30 09:47:54 +0200
commit2e4c3841e8f36fe58aeca4f785c2862d6c3f2887 (patch)
tree3f60cc6626a601ef5a65a2ca83af0fd1467a9c6e
parent8ca8c81a6677bd0228d0d4b07de0a8919cd2659d (diff)
Some minor MM related refactoring
Refactors some code of SwFEShell::Paste and SwDBManager::MergeDocuments to make it more readable. Change-Id: Ifd78d6a44fa78eaf1f4fca63f4bbd3ee43ca129d Reviewed-on: https://gerrit.libreoffice.org/10965 Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com> (cherry picked from commit 8a798ef5582e91ca51ffc835f6b8c8521bee3174) Conflicts: sw/source/core/frmedt/fecopy.cxx sw/source/uibase/dbui/dbmgr.cxx
-rw-r--r--sw/source/core/frmedt/fecopy.cxx19
-rw-r--r--sw/source/ui/dbui/dbmgr.cxx25
2 files changed, 16 insertions, 28 deletions
diff --git a/sw/source/core/frmedt/fecopy.cxx b/sw/source/core/frmedt/fecopy.cxx
index 6c503dc8c533..09217c86b1cd 100644
--- a/sw/source/core/frmedt/fecopy.cxx
+++ b/sw/source/core/frmedt/fecopy.cxx
@@ -690,7 +690,7 @@ sal_Bool SwFEShell::Paste( SwDoc* pClpDoc, sal_Bool bIncludingPageFrames )
// If there are table formulas in the area, then display the table first
// so that the table formula can calculate a new value first
// (individual boxes in the area are retrieved via the layout)
- SwFieldType* pTblFldTyp = GetDoc()->GetSysFldType( RES_TABLEFLD );
+ SwFieldType* pTblFldTyp = GetDoc()->GetSysFldType( RES_TABLEFLD );
SwTableNode *pDestNd, *pSrcNd = aCpyPam.GetNode()->GetTableNode();
if( !pSrcNd ) // TabellenNode ?
@@ -1078,19 +1078,12 @@ sal_Bool SwFEShell::Paste( SwDoc* pClpDoc, sal_Bool bIncludingPageFrames )
for ( sal_uInt16 i = 0; i < pClpDoc->GetSpzFrmFmts()->size(); ++i )
{
- bool bInsWithFmt = true;
const SwFrmFmt& rCpyFmt = *(*pClpDoc->GetSpzFrmFmts())[i];
- if( bInsWithFmt )
- {
- SwFmtAnchor aAnchor( rCpyFmt.GetAnchor() );
- if ( FLY_AT_PAGE == aAnchor.GetAnchorId() )
- {
- aAnchor.SetPageNum( aAnchor.GetPageNum() + nStartPageNumber - 1 );
- }
- else
- continue;
- GetDoc()->CopyLayoutFmt( rCpyFmt, aAnchor, true, true );
- }
+ SwFmtAnchor aAnchor( rCpyFmt.GetAnchor() );
+ if ( FLY_AT_PAGE != aAnchor.GetAnchorId() )
+ continue;
+ aAnchor.SetPageNum( aAnchor.GetPageNum() + nStartPageNumber - 1 );
+ GetDoc()->CopyLayoutFmt( rCpyFmt, aAnchor, true, true );
}
}
}
diff --git a/sw/source/ui/dbui/dbmgr.cxx b/sw/source/ui/dbui/dbmgr.cxx
index 8611149ff396..c0d6edecda5c 100644
--- a/sw/source/ui/dbui/dbmgr.cxx
+++ b/sw/source/ui/dbui/dbmgr.cxx
@@ -2920,17 +2920,12 @@ sal_Int32 SwNewDBMgr::MergeDocuments( SwMailMergeConfigItem& rMMConfig,
}
}
if(nDocNo == 1 || bPageStylesWithHeaderFooter)
- {
pTargetView->GetDocShell()->_LoadStyles( *rSourceView.GetDocShell(), sal_True );
- }
if(nDocNo > 1)
- {
pTargetShell->InsertPageBreak( &sModifiedStartingPageDesc, nStartingPageNo );
- }
else
- {
pTargetShell->SetPageStyle(sModifiedStartingPageDesc);
- }
+
sal_uInt16 nPageCountBefore = pTargetShell->GetPageCnt();
OSL_ENSURE(!pTargetShell->GetTableFmt(),"target document ends with a table - paragraph should be appended");
bool para_added = false;
@@ -2938,9 +2933,9 @@ sal_Int32 SwNewDBMgr::MergeDocuments( SwMailMergeConfigItem& rMMConfig,
//#i51359# add a second paragraph in case there's only one
{
SwNodeIndex aIdx( pWorkDoc->GetNodes().GetEndOfExtras(), 2 );
- SwPosition aTestPos( aIdx );
- SwCursor aTestCrsr(aTestPos,0,false);
- if(!aTestCrsr.MovePara(fnParaNext, fnParaStart))
+ SwPosition aTestPos( aIdx );
+ SwCursor aTestCrsr( aTestPos, 0, false );
+ if ( !aTestCrsr.MovePara(fnParaNext, fnParaStart) )
{
//append a paragraph
pWorkDoc->AppendTxtNode( aTestPos );
@@ -2973,7 +2968,7 @@ sal_Int32 SwNewDBMgr::MergeDocuments( SwMailMergeConfigItem& rMMConfig,
lcl_SaveDoc( xTargetDocShell, "MergeDoc" );
#endif
- //add the document info to the config item
+ // add the document info to the config item
SwDocMergeInfo aMergeInfo;
aMergeInfo.nStartPageInTarget = nPageCountBefore;
//#i72820# calculate layout to be able to find the correct page index
@@ -2987,17 +2982,17 @@ sal_Int32 SwNewDBMgr::MergeDocuments( SwMailMergeConfigItem& rMMConfig,
for( sal_uInt16 i = 0; i < 25; i++)
Application::Reschedule();
- //restore the ole DBMgr
+ // restore the old DBMgr
pWorkDoc->SetNewDBMgr( pWorkDBMgr );
- //now the temporary document should be closed
- SfxObjectShellRef xDocSh(pWorkView->GetDocShell());
- xDocSh->DoClose();
+ // close the temporary document
+ xWorkDocSh->DoClose();
+
nEndRow = pImpl->pMergeData->xResultSet->getRow();
++nDocNo;
} while( !bCancel &&
(bSynchronizedDoc && (nStartRow != nEndRow)? ExistsNextRecord() : ToNextMergeRecord()));
- //deselect all, go out of the frame and go to the beginning of the document
+ // deselect all, go out of the frame and go to the beginning of the document
Point aPt(LONG_MIN, LONG_MIN);
pTargetShell->SelectObj(aPt, SW_LEAVE_FRAME);
if (pTargetShell->IsSelFrmMode())