update dev300-m58
[ooovba.git] / sw / source / ui / uiview / viewprt.cxx
blob443eee31c099eecf4f00209df80832d1068f4277
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: viewprt.cxx,v $
10 * $Revision: 1.42 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_sw.hxx"
34 #include <com/sun/star/text/NotePrintMode.hpp>
36 #if STLPORT_VERSION>=321
37 #include <cstdarg>
38 #endif
40 #ifndef _CMDID_H
41 #include <cmdid.h>
42 #endif
44 #ifndef _SVSTDARR_HXX
45 #define _SVSTDARR_STRINGSDTOR
46 #include <svtools/svstdarr.hxx>
47 #endif
48 #include <sfx2/request.hxx>
50 #include <sfx2/app.hxx>
51 #include <svtools/flagitem.hxx>
52 #include <vcl/msgbox.hxx>
53 #include <svtools/printdlg.hxx>
54 #include <sfx2/printer.hxx>
55 #include <sfx2/prnmon.hxx>
56 #include <svx/paperinf.hxx>
57 #include <sfx2/dispatch.hxx>
58 #include <svtools/misccfg.hxx>
59 #include <svx/prtqry.hxx>
60 #include <svx/svdview.hxx>
61 #include <svtools/eitem.hxx>
62 #include <svtools/stritem.hxx>
63 #include <svtools/intitem.hxx>
64 #include <svtools/flagitem.hxx>
65 #include <svx/linkmgr.hxx>
67 #include <modcfg.hxx>
68 #include <edtwin.hxx>
69 #include <view.hxx>
70 #include <wrtsh.hxx>
71 #include <docsh.hxx>
72 #include <viewopt.hxx>
73 #include <prtopt.hxx>
74 #include <swprtopt.hxx>
75 #include <fontcfg.hxx>
76 #include <cfgitems.hxx>
77 #include <dbmgr.hxx>
78 #include <docstat.hxx>
79 #include <viewfunc.hxx>
80 #include <swmodule.hxx>
81 #include <wview.hxx>
82 #include <doc.hxx>
83 #include <fldbas.hxx>
85 #include <globals.hrc>
86 #include <view.hrc>
87 #include <app.hrc>
88 #include <svtools/eitem.hxx>
89 #include <swwrtshitem.hxx>
90 #include "swabstdlg.hxx"
91 #include <svtools/slstitm.hxx>
93 #include <unomid.h>
95 using namespace ::com::sun::star;
98 /*--------------------------------------------------------------------
99 Beschreibung: Drucker an Sfx uebergeben
100 --------------------------------------------------------------------*/
103 SfxPrinter* __EXPORT SwView::GetPrinter( BOOL bCreate )
105 const IDocumentDeviceAccess* pIDDA = GetWrtShell().getIDocumentDeviceAccess();
106 SfxPrinter *pOld = pIDDA->getPrinter( false );
107 SfxPrinter *pPrt = pIDDA->getPrinter( bCreate );
108 if ( pOld != pPrt )
110 BOOL bWeb = 0 != PTR_CAST(SwWebView, this);
111 ::SetAppPrintOptions( &GetWrtShell(), bWeb );
113 return pPrt;
116 /*--------------------------------------------------------------------
117 Beschreibung: Druckerwechsel weitermelden
118 --------------------------------------------------------------------*/
120 void SetPrinter( IDocumentDeviceAccess* pIDDA, SfxPrinter* pNew, BOOL bWeb )
122 SwPrintOptions* pOpt = SW_MOD()->GetPrtOptions(bWeb);
123 if( !pOpt)
124 return;
126 // Applikationseigene Druckoptionen aus SfxPrinter auslesen
127 const SfxItemSet& rSet = pNew->GetOptions();
129 const SwAddPrinterItem* pAddPrinterAttr;
130 if( SFX_ITEM_SET == rSet.GetItemState( FN_PARAM_ADDPRINTER, FALSE,
131 (const SfxPoolItem**)&pAddPrinterAttr ) )
133 if( pIDDA )
134 pIDDA->setPrintData( *pAddPrinterAttr );
135 if( pAddPrinterAttr->GetFax().getLength() )
136 pOpt->SetFaxName(pAddPrinterAttr->GetFax());
141 USHORT __EXPORT SwView::SetPrinter(SfxPrinter* pNew, USHORT nDiffFlags, bool )
143 SwWrtShell &rSh = GetWrtShell();
144 if ( (SFX_PRINTER_JOBSETUP | SFX_PRINTER_PRINTER) & nDiffFlags )
146 rSh.getIDocumentDeviceAccess()->setPrinter( pNew, true, true );
147 if ( nDiffFlags & SFX_PRINTER_PRINTER )
148 rSh.SetModified();
150 BOOL bWeb = 0 != PTR_CAST(SwWebView, this);
151 if ( nDiffFlags & SFX_PRINTER_OPTIONS )
152 ::SetPrinter( rSh.getIDocumentDeviceAccess(), pNew, bWeb );
154 const BOOL bChgOri = nDiffFlags & SFX_PRINTER_CHG_ORIENTATION ? TRUE : FALSE;
155 const BOOL bChgSize= nDiffFlags & SFX_PRINTER_CHG_SIZE ? TRUE : FALSE;
156 if ( bChgOri || bChgSize )
158 rSh.StartAllAction();
159 if ( bChgOri )
160 rSh.ChgAllPageOrientation( USHORT(pNew->GetOrientation()) );
161 if ( bChgSize )
163 Size aSz( SvxPaperInfo::GetPaperSize( pNew ) );
164 rSh.ChgAllPageSize( aSz );
166 rSh.SetModified();
167 rSh.EndAllAction();
168 InvalidateRulerPos();
170 return 0;
173 /*--------------------------------------------------------------------
174 Beschreibung:
175 --------------------------------------------------------------------*/
177 ErrCode SwView::DoPrint( SfxPrinter *pPrinter, PrintDialog *pDlg, BOOL bSilent, BOOL bIsAPI )
179 // First test
180 SwWrtShell* pSh = &GetWrtShell();
181 SwNewDBMgr* pMgr = pSh->GetNewDBMgr();
183 int bPrintSelection = -1;
184 USHORT nMergeType = pMgr->GetMergeType();
185 if( DBMGR_MERGE_MAILMERGE != nMergeType &&
186 DBMGR_MERGE_DOCUMENTS != nMergeType &&
187 !pDlg &&
188 !bIsAPI && ( pSh->IsSelection() || pSh->IsFrmSelected() ||
189 pSh->IsObjSelected() ) )
191 short nBtn = SvxPrtQryBox(&GetEditWin()).Execute();
192 if( RET_CANCEL == nBtn )
193 return ERRCODE_IO_ABORT;
195 if( RET_OK == nBtn )
196 bPrintSelection = 1;
197 else
198 bPrintSelection = 0;
201 // Der PrintProgress stellt Handler am Printer der ViewShell ein.
202 // Das kann natuerlich erste nach dem evtl. Umschalten des Druckers korrekt
203 // funktionieren. #55210#
204 // SfxPrintProgress *pProgress = new SfxPrintProgress( this, !bSilent );
205 SfxPrintProgress *pProgress = 0;
206 SfxPrinter *pDocPrinter = GetPrinter(TRUE);
207 if ( !pPrinter )
208 pPrinter = pDocPrinter;
209 else if ( pDocPrinter != pPrinter )
211 //Da der Doc-Drucker beim SetPrinter geloescht wird,
212 // muss man ihn vorher clonen
213 SfxPrinter* pClone = pDocPrinter->Clone();
214 SetPrinter( pPrinter, SFX_PRINTER_PRINTER );
215 pProgress = new SfxPrintProgress( this, !bSilent );
216 pProgress->RestoreOnEndPrint( pClone );
218 if(!pProgress)
219 pProgress = new SfxPrintProgress( this, !bSilent );
220 pProgress->SetWaitMode(FALSE);
222 BOOL bStartJob = pPrinter->InitJob( &GetEditWin(),
223 !bIsAPI && pSh->HasDrawView() && pSh->GetDrawView()->GetModel()->HasTransparentObjects());
224 if( bStartJob )
226 // Drucker starten
227 PreparePrint( pDlg );
228 SfxObjectShell *pObjShell = GetViewFrame()->GetObjectShell();
229 //#i82625# GetTitle( 0 ) doesn't work for 'embedded' documents like forms or reports
230 String sDocumentTitle( pObjShell->GetTitle(SFX_TITLE_APINAME));
231 SwPrtOptions aOpts( sDocumentTitle );
232 BOOL bWeb = 0 != PTR_CAST(SwWebView, this);
233 nMergeType = pMgr->GetMergeType();
235 BOOL bPrtPros;
236 BOOL bPrtPros_RTL;
237 SwView::MakeOptions( pDlg, aOpts, &bPrtPros, &bPrtPros_RTL, bWeb, GetPrinter(),
238 pSh->getIDocumentDeviceAccess()->getPrintData() );
240 //set the appropriate view options to print
241 //on silent mode the field commands have to be switched off always
242 //on default print the user is asked what to do
243 const SwViewOption* pCurrentViewOptions = pSh->GetViewOptions();
244 bool bSwitchOff_IsFldName = pCurrentViewOptions->IsFldName() && pSh->IsAnyFieldInDoc();
246 if(!bSilent && bSwitchOff_IsFldName)
248 QueryBox aBox( &GetEditWin(), SW_RES( DLG_PRT_FIELDNAME ) );
249 USHORT nRet = aBox.Execute();
250 if( RET_CANCEL == nRet)
251 return ERRCODE_IO_ABORT;
252 // disable field commands
253 if( RET_NO != nRet )
255 bSwitchOff_IsFldName = false;
258 bool bApplyViewOptions = bSwitchOff_IsFldName;
259 //switch off display of hidden characters if on and hidden characters are in use
260 const sal_Bool bOldShowHiddenChar = pCurrentViewOptions->IsShowHiddenChar();
261 const sal_Bool bOldMetaChars = pCurrentViewOptions->IsViewMetaChars();
262 if( bOldShowHiddenChar != aOpts.IsPrintHiddenText()
263 && pSh->GetDoc()->ContainsHiddenChars())
264 bApplyViewOptions |= true;
265 //switch off display of hidden paragraphs if on and hidden paragraphs are in use
266 const sal_Bool bOldShowHiddenPara = pCurrentViewOptions->IsShowHiddenPara();
267 if( aOpts.IsPrintHiddenText() != bOldShowHiddenPara )
269 const SwFieldType* pFldType = pSh->GetDoc()->GetSysFldType(RES_HIDDENPARAFLD);
270 if( pFldType && pFldType->GetDepends())
271 bApplyViewOptions |= true;
273 const sal_Bool bOldShowHiddenField = pCurrentViewOptions->IsShowHiddenField();
274 if( aOpts.IsPrintHiddenText() != bOldShowHiddenField )
276 const SwFieldType* pFldType = pSh->GetDoc()->GetSysFldType(RES_HIDDENTXTFLD);
277 if( pFldType || pFldType->GetDepends())
278 bApplyViewOptions |= true;
281 SwViewOption* pOrgViewOption = 0;
282 bApplyViewOptions |= !aOpts.IsPrintTextPlaceholder();
283 if(bApplyViewOptions)
285 pOrgViewOption = new SwViewOption(*pSh->GetViewOptions());
286 if(bSwitchOff_IsFldName)
287 pOrgViewOption->SetFldName(aOpts.IsPrintHiddenText());
289 pOrgViewOption->SetShowHiddenChar(aOpts.IsPrintHiddenText());
290 pOrgViewOption->SetViewMetaChars(sal_True);
291 pOrgViewOption->SetShowHiddenPara(aOpts.IsPrintHiddenText());
292 pOrgViewOption->SetShowHiddenField(aOpts.IsPrintHiddenText());
293 pOrgViewOption->SetShowPlaceHolderFields( aOpts.bPrintTextPlaceholder );
295 SW_MOD()->ApplyUsrPref(*pOrgViewOption, this, VIEWOPT_DEST_VIEW_ONLY );
298 if( nMergeType == DBMGR_MERGE_MAILMERGE ||
299 DBMGR_MERGE_DOCUMENTS == nMergeType )
301 if(DBMGR_MERGE_DOCUMENTS == nMergeType)
302 bStartJob = pMgr->MergePrintDocuments( *this, aOpts, *pProgress, bIsAPI );
303 else
304 bStartJob = pMgr->MergePrint( *this, aOpts, *pProgress, bIsAPI );
306 else
308 const BOOL bLockedView = pSh->IsViewLocked();
309 pSh->LockView( TRUE );
311 //BrowseView abschalten und die View gegen alle Paints locken.
312 BOOL bBrowse = pSh->getIDocumentSettingAccess()->get(IDocumentSettingAccess::BROWSE_MODE);
313 SfxAllItemSet aSet( SFX_APP()->GetPool() );
314 SfxBoolItem aBrowse( SID_BROWSER_MODE, FALSE );
315 if ( bBrowse )
317 if ( pSh->GetWin() )
318 pSh->GetWin()->Update();
319 pSh->LockPaint();
320 aSet.Put( aBrowse, aBrowse.Which() );
321 SfxRequest aReq( SID_BROWSER_MODE, 0, aSet );
322 GetDocShell()->Execute( aReq );
325 // die Felder aktualisieren
326 BOOL bIsModified = pSh->IsModified();
327 pSh->StartAllAction();
328 SwDocStat aDocStat;
329 pSh->UpdateDocStat( aDocStat );
330 pSh->EndAllTblBoxEdit();
331 pSh->ViewShell::UpdateFlds(TRUE);
332 if( pSh->IsCrsrInTbl() )
334 pSh->ClearTblBoxCntnt();
335 pSh->SaveTblBoxCntnt();
337 pSh->EndAllAction();
339 if( !bIsModified )
340 pSh->ResetModified();
342 if( -1 != bPrintSelection )
343 aOpts.bPrintSelection = 0 != bPrintSelection;
345 uno::Sequence< beans::PropertyValue> aViewProperties(18);
346 beans::PropertyValue* pViewProperties = aViewProperties.getArray();
347 pViewProperties[1].Name = C2U("PrintGraphics");
348 pViewProperties[1].Value <<= (sal_Bool)aOpts.IsPrintGraphic();
349 pViewProperties[2].Name = C2U("PrintTables");
350 pViewProperties[2].Value <<= (sal_Bool)aOpts.IsPrintTable();
351 pViewProperties[3].Name = C2U("PrintDrawings");
352 pViewProperties[3].Value <<= (sal_Bool)aOpts.IsPrintDraw();
353 pViewProperties[4].Name = C2U("PrintLeftPages");
354 pViewProperties[4].Value <<= (sal_Bool)aOpts.IsPrintLeftPage();
355 pViewProperties[5].Name = C2U("PrintRightPages");
356 pViewProperties[5].Value <<= (sal_Bool)aOpts.IsPrintRightPage();
357 pViewProperties[6].Name = C2U("PrintControls");
358 pViewProperties[6].Value <<= (sal_Bool)aOpts.IsPrintControl();
359 pViewProperties[7].Name = C2U("PrintReversed");
360 pViewProperties[7].Value <<= (sal_Bool)aOpts.IsPrintReverse();
361 pViewProperties[8].Name = C2U("PrintPaperFromSetup");
362 pViewProperties[8].Value <<= (sal_Bool)aOpts.IsPaperFromSetup();
363 pViewProperties[9].Name = C2U("PrintFaxName");
364 pViewProperties[9].Value <<= aOpts.GetFaxName();
365 pViewProperties[10].Name = C2U("PrintAnnotationMode");
366 pViewProperties[10].Value <<= (text::NotePrintMode) aOpts.GetPrintPostIts();
367 pViewProperties[11].Name = C2U("PrintProspect");
368 pViewProperties[11].Value <<= (sal_Bool)aOpts.IsPrintProspect();
369 pViewProperties[12].Name = C2U("PrintPageBackground");
370 pViewProperties[12].Value <<= (sal_Bool)aOpts.IsPrintPageBackground();
371 pViewProperties[13].Name = C2U("PrintBlackFonts");
372 pViewProperties[13].Value <<= (sal_Bool)aOpts.IsPrintBlackFont();
373 pViewProperties[0].Name = C2U("IsSinglePrintJob");
374 pViewProperties[0].Value <<= (sal_Bool)aOpts.IsPrintSingleJobs();
375 pViewProperties[14].Name = C2U("Selection");
376 pViewProperties[14].Value <<= (sal_Bool)aOpts.bPrintSelection;
377 pViewProperties[15].Name = C2U("PrintEmptyPages");
378 pViewProperties[15].Value <<= (sal_Bool)aOpts.bPrintEmptyPages;
379 pViewProperties[16].Name = C2U("PrintHiddenText");
380 pViewProperties[16].Value <<= (sal_Bool)aOpts.bPrintHiddenText;
381 pViewProperties[17].Name = C2U("PrintTextPlaceholder");
382 pViewProperties[17].Value <<= (sal_Bool)aOpts.bPrintTextPlaceholder;
383 SetAdditionalPrintOptions(aViewProperties);
385 SfxViewShell::Print(*pProgress, bIsAPI );
386 if ( !pProgress->IsAborted() )
388 if( bPrtPros )
390 bStartJob = pPrinter->StartJob( aOpts.GetJobName() );
391 if( bStartJob )
392 pSh->PrintProspect( aOpts, *pProgress, bPrtPros_RTL );
394 else
395 bStartJob = pSh->Prt( aOpts, pProgress );
397 if ( bBrowse )
399 aBrowse.SetValue( TRUE );
400 aSet.Put( aBrowse, aBrowse.Which() );
401 SfxRequest aReq( SID_BROWSER_MODE, 0, aSet );
402 GetDocShell()->Execute( aReq );
403 pSh->UnlockPaint();
406 else
407 bStartJob = FALSE;
409 pSh->LockView( bLockedView );
411 if(pOrgViewOption)
413 if(bSwitchOff_IsFldName)
414 pOrgViewOption->SetFldName(TRUE);
415 pOrgViewOption->SetShowHiddenChar(bOldShowHiddenChar);
416 pOrgViewOption->SetViewMetaChars(bOldMetaChars);
417 pOrgViewOption->SetShowHiddenField(bOldShowHiddenField);
418 pOrgViewOption->SetShowHiddenPara(bOldShowHiddenPara);
419 //must to be set to sal_True anyway
420 pOrgViewOption->SetShowPlaceHolderFields( sal_True );
421 SW_MOD()->ApplyUsrPref(*pOrgViewOption, this, VIEWOPT_DEST_VIEW_ONLY );
422 delete pOrgViewOption;
426 if( !bStartJob )
428 // Printer konnte nicht gestartet werden
429 delete pProgress;
430 return pPrinter->GetError();
433 pProgress->Stop();
434 pProgress->DeleteOnEndPrint();
435 pPrinter->EndJob();
436 return pPrinter->GetError();
441 /*--------------------------------------------------------------------
442 Beschreibung: TabPage fuer applikationsspezifische Druckoptionen
443 --------------------------------------------------------------------*/
445 SfxTabPage* __EXPORT SwView::CreatePrintOptionsPage(Window* pParent,
446 const SfxItemSet& rSet)
448 return ::CreatePrintOptionsPage( pParent, rSet, FALSE );
451 /*--------------------------------------------------------------------
452 Beschreibung: Druckerdialog
453 --------------------------------------------------------------------*/
455 PrintDialog* CreatePrintDialog( Window* pParent, USHORT nPg, SwWrtShell* pSh )
457 PrintDialog *pDlg = new PrintDialog( pParent, false );
458 // pDlg->ChangeFirstPage( 1 );
460 if ( !nPg )
461 nPg = 1;
462 // pDlg->ChangeLastPage( nPg );
463 // pDlg->ChangeMaxPage( 9999 );
464 pDlg->EnableRange( PRINTDIALOG_FROMTO );
466 if (pSh && (pSh->IsSelection() || pSh->IsFrmSelected() || pSh->IsObjSelected()))
467 pDlg->EnableRange( PRINTDIALOG_SELECTION );
469 pDlg->SetRangeText( String::CreateFromInt32(nPg) );
470 pDlg->EnableRange( PRINTDIALOG_RANGE );
471 pDlg->EnableCollate();
472 return pDlg;
475 /*--------------------------------------------------------------------
476 Beschreibung:
477 --------------------------------------------------------------------*/
479 PrintDialog* __EXPORT SwView::CreatePrintDialog( Window* pParent )
481 // AMA: Hier sollte vielleicht die virtuelle Seitennummer angezeigt werden,
482 // aber nur, wenn das Drucken virtuelle Seitennummern und nicht wie
483 // bisher (auch beim SWG 2.0) physikalische beachtet werden.
484 return ::CreatePrintDialog( pParent, GetWrtShell().GetPhyPageNum(), &GetWrtShell() );
487 /*--------------------------------------------------------------------
488 Beschreibung: Print-Dispatcher
489 --------------------------------------------------------------------*/
491 void __EXPORT SwView::ExecutePrint(SfxRequest& rReq)
493 BOOL bWeb = 0 != PTR_CAST(SwWebView, this);
494 ::SetAppPrintOptions( &GetWrtShell(), bWeb );
495 switch (rReq.GetSlot())
497 case FN_FAX:
499 SwPrintOptions* pPrintOptions = SW_MOD()->GetPrtOptions(bWeb);
500 String sFaxName(pPrintOptions->GetFaxName());
501 if (sFaxName.Len())
503 SfxStringItem aPrinterName(SID_PRINTER_NAME, sFaxName);
504 SfxBoolItem aSilent( SID_SILENT, TRUE );
505 GetViewFrame()->GetDispatcher()->Execute( SID_PRINTDOC,
506 SFX_CALLMODE_SYNCHRON|SFX_CALLMODE_RECORD,
507 &aPrinterName, &aSilent, 0L );
509 else
511 InfoBox aInfoBox(&GetEditWin(), SW_RES(MSG_ERR_NO_FAX));
512 String sMsg = aInfoBox.GetMessText();
513 USHORT nResNo = bWeb ? STR_WEBOPTIONS : STR_TEXTOPTIONS;
514 sMsg.SearchAndReplace(String::CreateFromAscii("%1"), String(SW_RES(nResNo)));
515 aInfoBox.SetMessText(sMsg);
516 aInfoBox.Execute();
517 SfxUInt16Item aDefPage(SID_SW_EDITOPTIONS, TP_OPTPRINT_PAGE);
518 GetViewFrame()->GetDispatcher()->Execute(SID_SW_EDITOPTIONS,
519 SFX_CALLMODE_SYNCHRON|SFX_CALLMODE_RECORD,
520 &aDefPage, 0L );
523 break;
524 case SID_PRINTDOC:
525 case SID_PRINTDOCDIRECT:
527 SwWrtShell* pSh = &GetWrtShell();
528 SFX_REQUEST_ARG(rReq, pSilentItem, SfxBoolItem, SID_SILENT, FALSE);
529 BOOL bSilent = pSilentItem ? pSilentItem->GetValue() : FALSE;
530 SFX_REQUEST_ARG(rReq, pPrintFromMergeItem, SfxBoolItem, FN_QRY_MERGE, FALSE);
531 if(pPrintFromMergeItem)
532 rReq.RemoveItem(FN_QRY_MERGE);
533 BOOL bFromMerge = pPrintFromMergeItem ? pPrintFromMergeItem->GetValue() : FALSE;
534 SwMiscConfig aMiscConfig;
535 if(!bSilent && !bFromMerge &&
536 SW_MOD()->GetModuleConfig()->IsAskForMailMerge() && pSh->IsAnyDatabaseFieldInDoc())
538 QueryBox aBox( &GetEditWin(), SW_RES( MSG_PRINT_AS_MERGE ));
539 short nRet = aBox.Execute();
540 if(RET_YES == nRet)
542 SfxBoolItem aBool(FN_QRY_MERGE, TRUE);
543 GetViewFrame()->GetDispatcher()->Execute(
544 FN_QRY_MERGE, SFX_CALLMODE_ASYNCHRON, &aBool, 0L);
545 rReq.Ignore();
546 return;
549 //#i61455# if master documentes are printed silently without loaded links then update the links now
550 if( bSilent && pSh->IsGlobalDoc() && !pSh->IsGlblDocSaveLinks() )
552 pSh->GetLinkManager().UpdateAllLinks( sal_False, sal_False, sal_False, 0 );
554 SfxViewShell::ExecuteSlot( rReq, SfxViewShell::GetInterface() );
555 return;
557 default:
558 ASSERT(!this, falscher Dispatcher);
559 return;
563 /*--------------------------------------------------------------------
564 Beschreibung: Page Drucker/Zusaetze erzeugen fuer SwView und
565 SwPagePreview
566 --------------------------------------------------------------------*/
568 SfxTabPage* CreatePrintOptionsPage( Window *pParent,
569 const SfxItemSet &rOptions, BOOL bPreview )
571 SfxTabPage* pPage = NULL;
572 SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
573 if ( pFact )
575 ::CreateTabPage fnCreatePage = pFact->GetTabPageCreatorFunc( TP_OPTPRINT_PAGE );
576 if ( fnCreatePage )
577 pPage = (*fnCreatePage)( pParent, rOptions );
579 SfxAllItemSet aSet(*(rOptions.GetPool()));
580 aSet.Put (SfxBoolItem(SID_PREVIEWFLAG_TYPE, bPreview));
581 aSet.Put (SfxBoolItem(SID_FAX_LIST, sal_True));
582 pPage->PageCreated(aSet);
583 return pPage;
587 void SetAppPrintOptions( ViewShell* pSh, BOOL bWeb )
589 SwPrintData aPrtData = *SW_MOD()->GetPrtOptions(bWeb);
590 const IDocumentDeviceAccess* pIDDA = pSh->getIDocumentDeviceAccess();
591 SwPrintData* pShellPrintData = pIDDA->getPrintData();
593 if(pShellPrintData)
594 aPrtData = *pShellPrintData;
596 if( pIDDA->getPrinter( false ) )
598 // Applikationseigene Druckoptionen in SfxPrinter schiessen
599 SwAddPrinterItem aAddPrinterItem (FN_PARAM_ADDPRINTER, aPrtData);
600 SfxItemSet aSet( pSh->GetAttrPool(),
601 FN_PARAM_ADDPRINTER, FN_PARAM_ADDPRINTER,
602 SID_HTML_MODE, SID_HTML_MODE,
603 SID_PRINTER_NOTFOUND_WARN, SID_PRINTER_NOTFOUND_WARN,
604 SID_PRINTER_CHANGESTODOC, SID_PRINTER_CHANGESTODOC,
605 0 );
607 SfxMiscCfg* pMisc = SFX_APP()->GetMiscConfig();
609 if(bWeb)
610 aSet.Put(SfxUInt16Item(SID_HTML_MODE,
611 ::GetHtmlMode(((SwWrtShell*)pSh)->GetView().GetDocShell())));
612 aSet.Put(SfxBoolItem(SID_PRINTER_NOTFOUND_WARN,
613 pMisc->IsNotFoundWarning() ));
614 aSet.Put(aAddPrinterItem);
615 aSet.Put( SfxFlagItem( SID_PRINTER_CHANGESTODOC,
616 (pMisc->IsPaperSizeWarning() ? SFX_PRINTER_CHG_SIZE : 0) |
617 (pMisc->IsPaperOrientationWarning() ? SFX_PRINTER_CHG_ORIENTATION : 0 )));
619 pIDDA->getPrinter( true )->SetOptions( aSet );