sw/source/core/frmedt/fecopy.cxx | 19 ++++++------------- sw/source/uibase/dbui/dbmgr.cxx | 25 ++++++++++--------------- 2 files changed, 16 insertions(+), 28 deletions(-)
New commits: commit 8a798ef5582e91ca51ffc835f6b8c8521bee3174 Author: Jan-Marek Glogowski <glo...@fbihome.de> Date: Fri Jun 27 14:58:24 2014 +0200 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 <caol...@redhat.com> Tested-by: Caolán McNamara <caol...@redhat.com> diff --git a/sw/source/core/frmedt/fecopy.cxx b/sw/source/core/frmedt/fecopy.cxx index f4fcbb6..e3612e4 100644 --- a/sw/source/core/frmedt/fecopy.cxx +++ b/sw/source/core/frmedt/fecopy.cxx @@ -681,7 +681,7 @@ bool SwFEShell::Paste( SwDoc* pClpDoc, 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()->getIDocumentFieldsAccess().GetSysFldType( RES_TABLEFLD ); + SwFieldType* pTblFldTyp = GetDoc()->getIDocumentFieldsAccess().GetSysFldType( RES_TABLEFLD ); SwTableNode *pDestNd, *pSrcNd = aCpyPam.GetNode().GetTableNode(); if( !pSrcNd ) // TabellenNode ? @@ -1077,19 +1077,12 @@ bool SwFEShell::Paste( SwDoc* pClpDoc, 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()->getIDocumentLayoutAccess().CopyLayoutFmt( rCpyFmt, aAnchor, true, true ); - } + SwFmtAnchor aAnchor( rCpyFmt.GetAnchor() ); + if ( FLY_AT_PAGE != aAnchor.GetAnchorId() ) + continue; + aAnchor.SetPageNum( aAnchor.GetPageNum() + nStartPageNumber - 1 ); + GetDoc()->getIDocumentLayoutAccess().CopyLayoutFmt( rCpyFmt, aAnchor, true, true ); } } } diff --git a/sw/source/uibase/dbui/dbmgr.cxx b/sw/source/uibase/dbui/dbmgr.cxx index a58b2e4..0b6aa6e 100644 --- a/sw/source/uibase/dbui/dbmgr.cxx +++ b/sw/source/uibase/dbui/dbmgr.cxx @@ -2897,17 +2897,12 @@ sal_Int32 SwDBManager::MergeDocuments( SwMailMergeConfigItem& rMMConfig, } } if(nDocNo == 1 || bPageStylesWithHeaderFooter) - { pTargetView->GetDocShell()->_LoadStyles( *rSourceView.GetDocShell(), 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; @@ -2915,9 +2910,9 @@ sal_Int32 SwDBManager::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->getIDocumentContentOperations().AppendTxtNode( aTestPos ); @@ -2950,7 +2945,7 @@ sal_Int32 SwDBManager::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 @@ -2964,17 +2959,17 @@ sal_Int32 SwDBManager::MergeDocuments( SwMailMergeConfigItem& rMMConfig, for( sal_uInt16 i = 0; i < 25; i++) Application::Reschedule(); - //restore the ole DBManager + // restore the old DBManager pWorkDoc->SetDBManager( pWorkDBManager ); - //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())
_______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits