[Libreoffice-commits] core.git: 2 commits - sw/source
Caolán McNamara
caolanm at redhat.com
Mon Jun 15 05:01:37 PDT 2015
sw/source/uibase/dbui/dbmgr.cxx | 116 ++++++++++++++++++++--------------------
1 file changed, 58 insertions(+), 58 deletions(-)
New commits:
commit 8f60697cf8e5227d503738e3c186433ac5dacfc8
Author: Caolán McNamara <caolanm at redhat.com>
Date: Mon Jun 15 13:00:30 2015 +0100
fix indent
Change-Id: I3dd04cd9d8e33d24c42e55b24c4f5e265e6265c2
diff --git a/sw/source/uibase/dbui/dbmgr.cxx b/sw/source/uibase/dbui/dbmgr.cxx
index 47fb017..2321dcc 100644
--- a/sw/source/uibase/dbui/dbmgr.cxx
+++ b/sw/source/uibase/dbui/dbmgr.cxx
@@ -1185,25 +1185,25 @@ bool SwDBManager::MergeMailFiles(SwWrtShell* pSourceShell,
// copy the source document
xWorkDocSh = pSourceDocSh->GetDoc()->CreateCopy( true );
- //create a view frame for the document
- pWorkView = static_cast< SwView* >( SfxViewFrame::LoadHiddenDocument( *xWorkDocSh, 0 )->GetViewShell() );
- //request the layout calculation
- SwWrtShell& rWorkShell = pWorkView->GetWrtShell();
- pWorkView->AttrChangedNotify( &rWorkShell );// in order for SelectShell to be called
-
- pWorkDoc = rWorkShell.GetDoc();
- pWorkDoc->ReplaceDocumentProperties( *pSourceDocSh->GetDoc());
- if ( (nMaxDumpDocs < 0) || (nDocNo <= nMaxDumpDocs) )
- lcl_SaveDoc( xWorkDocSh, "WorkDoc", nDocNo );
- pOldDBManager = pWorkDoc->GetDBManager();
- pWorkDoc->SetDBManager( this );
- pWorkDoc->getIDocumentLinksAdministration().EmbedAllLinks();
-
- // #i69458# lock fields to prevent access to the result set while calculating layout
- rWorkShell.LockExpFields();
- rWorkShell.CalcLayout();
- rWorkShell.UnlockExpFields();
- }
+ //create a view frame for the document
+ pWorkView = static_cast< SwView* >( SfxViewFrame::LoadHiddenDocument( *xWorkDocSh, 0 )->GetViewShell() );
+ //request the layout calculation
+ SwWrtShell& rWorkShell = pWorkView->GetWrtShell();
+ pWorkView->AttrChangedNotify( &rWorkShell );// in order for SelectShell to be called
+
+ pWorkDoc = rWorkShell.GetDoc();
+ pWorkDoc->ReplaceDocumentProperties( *pSourceDocSh->GetDoc());
+ if ( (nMaxDumpDocs < 0) || (nDocNo <= nMaxDumpDocs) )
+ lcl_SaveDoc( xWorkDocSh, "WorkDoc", nDocNo );
+ pOldDBManager = pWorkDoc->GetDBManager();
+ pWorkDoc->SetDBManager( this );
+ pWorkDoc->getIDocumentLinksAdministration().EmbedAllLinks();
+
+ // #i69458# lock fields to prevent access to the result set while calculating layout
+ rWorkShell.LockExpFields();
+ rWorkShell.CalcLayout();
+ rWorkShell.UnlockExpFields();
+ }
SwWrtShell& rWorkShell = pWorkView->GetWrtShell();
SfxGetpApp()->NotifyEvent(SfxEventHint(SW_EVENT_FIELD_MERGE, SwDocShell::GetEventName(STR_SW_EVENT_FIELD_MERGE), xWorkDocSh));
commit af8f938531909122ff7a056c2206af857324fdf3
Author: Caolán McNamara <caolanm at redhat.com>
Date: Mon Jun 15 12:58:57 2015 +0100
Resolves: tdf#92057 crash on mail-merge to printer
this appears to be a mismerge of
commit e0ad036eed6b151ea81311fcf9ba46f1726b103c
Author: Luboš Luňák <l.lunak at collabora.com>
Date: Thu Feb 19 16:39:06 2015 +0100
mailmerge doesn't need to use the singlefile technique for printing
It should be sufficient for every record to just update the fields and print
the document. The printing code apparently rather expects to do the printing
in one go, so split the functions up there.
Conflicts:
include/sfx2/viewsh.hxx
include/vcl/print.hxx
sfx2/source/view/viewprn.cxx
sw/source/uibase/dbui/dbmgr.cxx
sw/source/uibase/uno/unomailmerge.cxx
vcl/source/gdi/print3.cxx
where the else if block is positioned at a nutty location
Change-Id: Ia22e9e53c27256131283babaf779e57f157ba6b8
diff --git a/sw/source/uibase/dbui/dbmgr.cxx b/sw/source/uibase/dbui/dbmgr.cxx
index eb2c9c0..47fb017 100644
--- a/sw/source/uibase/dbui/dbmgr.cxx
+++ b/sw/source/uibase/dbui/dbmgr.cxx
@@ -1252,45 +1252,6 @@ bool SwDBManager::MergeMailFiles(SwWrtShell* pSourceShell,
lcl_CopyFollowPageDesc( *pTargetShell, *pWorkPageDesc, *pTargetPageDesc, nDocNo );
}
}
- else if( rMergeDescriptor.nMergeType == DBMGR_MERGE_PRINTER )
- {
- assert(!bCreateSingleFile);
- if( 1 == nDocNo ) // set up printing only once at the beginning
- {
- // printing should be done synchronously otherwise the document
- // might already become invalid during the process
- uno::Sequence< beans::PropertyValue > aOptions( rMergeDescriptor.aPrintOptions );
-
- aOptions.realloc( 2 );
- aOptions[ 0 ].Name = "Wait";
- aOptions[ 0 ].Value <<= sal_True;
- aOptions[ 1 ].Name = "MonitorVisible";
- aOptions[ 1 ].Value <<= sal_False;
- // move print options
- const beans::PropertyValue* pPrintOptions = rMergeDescriptor.aPrintOptions.getConstArray();
- for( sal_Int32 nOption = 0, nIndex = 1 ; nOption < rMergeDescriptor.aPrintOptions.getLength(); ++nOption)
- {
- if( pPrintOptions[nOption].Name == "CopyCount" || pPrintOptions[nOption].Name == "FileName"
- || pPrintOptions[nOption].Name == "Collate" || pPrintOptions[nOption].Name == "Pages"
- || pPrintOptions[nOption].Name == "Wait" || pPrintOptions[nOption].Name == "PrinterName" )
- {
- // add an option
- aOptions.realloc( nIndex + 1 );
- aOptions[ nIndex ].Name = pPrintOptions[nOption].Name;
- aOptions[ nIndex++ ].Value = pPrintOptions[nOption].Value ;
- }
- }
- pWorkView->StartPrint( aOptions, IsMergeSilent(), rMergeDescriptor.bPrintAsync );
- SfxPrinter* pDocPrt = pWorkView->GetPrinter(false);
- JobSetup aJobSetup = pDocPrt ? pDocPrt->GetJobSetup() : SfxViewShell::GetJobSetup();
- Printer::PreparePrintJob( pWorkView->GetPrinterController(), aJobSetup );
-#if ENABLE_CUPS && !defined(MACOSX)
- psp::PrinterInfoManager::get().startBatchPrint();
-#endif
- }
- if( !Printer::ExecutePrintJob( pWorkView->GetPrinterController()))
- bCancel = true;
- }
else
pTargetPageDesc = pTargetShell->FindPageDescByName( sModifiedStartingPageDesc );
@@ -1313,6 +1274,45 @@ bool SwDBManager::MergeMailFiles(SwWrtShell* pSourceShell,
rMergeDescriptor.pMailMergeConfigItem->AddMergedDocument( aMergeInfo );
}
}
+ else if( rMergeDescriptor.nMergeType == DBMGR_MERGE_PRINTER )
+ {
+ assert(!bCreateSingleFile);
+ if( 1 == nDocNo ) // set up printing only once at the beginning
+ {
+ // printing should be done synchronously otherwise the document
+ // might already become invalid during the process
+ uno::Sequence< beans::PropertyValue > aOptions( rMergeDescriptor.aPrintOptions );
+
+ aOptions.realloc( 2 );
+ aOptions[ 0 ].Name = "Wait";
+ aOptions[ 0 ].Value <<= sal_True;
+ aOptions[ 1 ].Name = "MonitorVisible";
+ aOptions[ 1 ].Value <<= sal_False;
+ // move print options
+ const beans::PropertyValue* pPrintOptions = rMergeDescriptor.aPrintOptions.getConstArray();
+ for( sal_Int32 nOption = 0, nIndex = 1 ; nOption < rMergeDescriptor.aPrintOptions.getLength(); ++nOption)
+ {
+ if( pPrintOptions[nOption].Name == "CopyCount" || pPrintOptions[nOption].Name == "FileName"
+ || pPrintOptions[nOption].Name == "Collate" || pPrintOptions[nOption].Name == "Pages"
+ || pPrintOptions[nOption].Name == "Wait" || pPrintOptions[nOption].Name == "PrinterName" )
+ {
+ // add an option
+ aOptions.realloc( nIndex + 1 );
+ aOptions[ nIndex ].Name = pPrintOptions[nOption].Name;
+ aOptions[ nIndex++ ].Value = pPrintOptions[nOption].Value ;
+ }
+ }
+ pWorkView->StartPrint( aOptions, IsMergeSilent(), rMergeDescriptor.bPrintAsync );
+ SfxPrinter* pDocPrt = pWorkView->GetPrinter(false);
+ JobSetup aJobSetup = pDocPrt ? pDocPrt->GetJobSetup() : SfxViewShell::GetJobSetup();
+ Printer::PreparePrintJob( pWorkView->GetPrinterController(), aJobSetup );
+#if ENABLE_CUPS && !defined(MACOSX)
+ psp::PrinterInfoManager::get().startBatchPrint();
+#endif
+ }
+ if( !Printer::ExecutePrintJob( pWorkView->GetPrinterController()))
+ bCancel = true;
+ }
else
{
assert( createTempFile );
More information about the Libreoffice-commits
mailing list