sw/source/uibase/dbui/dbmgr.cxx |   78 ++++++++++++++++++++--------------------
 1 file changed, 39 insertions(+), 39 deletions(-)

New commits:
commit b6a2f00e8db0dab8d3b9eead6f8a4d2eee845a80
Author: Caolán McNamara <caol...@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.lu...@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
    (cherry picked from commit af8f938531909122ff7a056c2206af857324fdf3)
    Reviewed-on: https://gerrit.libreoffice.org/16292
    Reviewed-by: Caolán McNamara <caol...@redhat.com>
    Tested-by: Caolán McNamara <caol...@redhat.com>

diff --git a/sw/source/uibase/dbui/dbmgr.cxx b/sw/source/uibase/dbui/dbmgr.cxx
index a3ab6d9..922006d 100644
--- a/sw/source/uibase/dbui/dbmgr.cxx
+++ b/sw/source/uibase/dbui/dbmgr.cxx
@@ -1186,45 +1186,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 );
 
@@ -1247,6 +1208,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 );
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to