1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: viewprt.cxx,v $
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
45 #define _SVSTDARR_STRINGSDTOR
46 #include <svtools/svstdarr.hxx>
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>
72 #include <viewopt.hxx>
74 #include <swprtopt.hxx>
75 #include <fontcfg.hxx>
76 #include <cfgitems.hxx>
78 #include <docstat.hxx>
79 #include <viewfunc.hxx>
80 #include <swmodule.hxx>
85 #include <globals.hrc>
88 #include <svtools/eitem.hxx>
89 #include <swwrtshitem.hxx>
90 #include "swabstdlg.hxx"
91 #include <svtools/slstitm.hxx>
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
);
110 BOOL bWeb
= 0 != PTR_CAST(SwWebView
, this);
111 ::SetAppPrintOptions( &GetWrtShell(), bWeb
);
116 /*--------------------------------------------------------------------
117 Beschreibung: Druckerwechsel weitermelden
118 --------------------------------------------------------------------*/
120 void SetPrinter( IDocumentDeviceAccess
* pIDDA
, SfxPrinter
* pNew
, BOOL bWeb
)
122 SwPrintOptions
* pOpt
= SW_MOD()->GetPrtOptions(bWeb
);
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
) )
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 SfxPrinter
* pOld
= rSh
.getIDocumentDeviceAccess()->getPrinter( false );
145 if ( pOld
&& pOld
->IsPrinting() )
146 return SFX_PRINTERROR_BUSY
;
148 if ( (SFX_PRINTER_JOBSETUP
| SFX_PRINTER_PRINTER
) & nDiffFlags
)
150 rSh
.getIDocumentDeviceAccess()->setPrinter( pNew
, true, true );
151 if ( nDiffFlags
& SFX_PRINTER_PRINTER
)
154 BOOL bWeb
= 0 != PTR_CAST(SwWebView
, this);
155 if ( nDiffFlags
& SFX_PRINTER_OPTIONS
)
156 ::SetPrinter( rSh
.getIDocumentDeviceAccess(), pNew
, bWeb
);
158 const BOOL bChgOri
= nDiffFlags
& SFX_PRINTER_CHG_ORIENTATION
? TRUE
: FALSE
;
159 const BOOL bChgSize
= nDiffFlags
& SFX_PRINTER_CHG_SIZE
? TRUE
: FALSE
;
160 if ( bChgOri
|| bChgSize
)
162 rSh
.StartAllAction();
164 rSh
.ChgAllPageOrientation( USHORT(pNew
->GetOrientation()) );
167 Size
aSz( SvxPaperInfo::GetPaperSize( pNew
) );
168 rSh
.ChgAllPageSize( aSz
);
172 InvalidateRulerPos();
177 /*--------------------------------------------------------------------
179 --------------------------------------------------------------------*/
181 ErrCode
SwView::DoPrint( SfxPrinter
*pPrinter
, PrintDialog
*pDlg
, BOOL bSilent
, BOOL bIsAPI
)
184 SwWrtShell
* pSh
= &GetWrtShell();
185 SwNewDBMgr
* pMgr
= pSh
->GetNewDBMgr();
187 int bPrintSelection
= -1;
188 USHORT nMergeType
= pMgr
->GetMergeType();
189 if( DBMGR_MERGE_MAILMERGE
!= nMergeType
&&
190 DBMGR_MERGE_DOCUMENTS
!= nMergeType
&&
192 !bIsAPI
&& ( pSh
->IsSelection() || pSh
->IsFrmSelected() ||
193 pSh
->IsObjSelected() ) )
195 short nBtn
= SvxPrtQryBox(&GetEditWin()).Execute();
196 if( RET_CANCEL
== nBtn
)
197 return ERRCODE_IO_ABORT
;
205 // Der PrintProgress stellt Handler am Printer der ViewShell ein.
206 // Das kann natuerlich erste nach dem evtl. Umschalten des Druckers korrekt
207 // funktionieren. #55210#
208 // SfxPrintProgress *pProgress = new SfxPrintProgress( this, !bSilent );
209 SfxPrintProgress
*pProgress
= 0;
210 SfxPrinter
*pDocPrinter
= GetPrinter(TRUE
);
212 pPrinter
= pDocPrinter
;
213 else if ( pDocPrinter
!= pPrinter
)
215 //Da der Doc-Drucker beim SetPrinter geloescht wird,
216 // muss man ihn vorher clonen
217 SfxPrinter
* pClone
= pDocPrinter
->Clone();
218 SetPrinter( pPrinter
, SFX_PRINTER_PRINTER
);
219 pProgress
= new SfxPrintProgress( this, !bSilent
);
220 pProgress
->RestoreOnEndPrint( pClone
);
223 pProgress
= new SfxPrintProgress( this, !bSilent
);
224 pProgress
->SetWaitMode(FALSE
);
226 BOOL bStartJob
= pPrinter
->InitJob( &GetEditWin(),
227 !bIsAPI
&& pSh
->HasDrawView() && pSh
->GetDrawView()->GetModel()->HasTransparentObjects());
231 PreparePrint( pDlg
);
232 SfxObjectShell
*pObjShell
= GetViewFrame()->GetObjectShell();
233 //#i82625# GetTitle( 0 ) doesn't work for 'embedded' documents like forms or reports
234 String
sDocumentTitle( pObjShell
->GetTitle(SFX_TITLE_APINAME
));
235 SwPrtOptions
aOpts( sDocumentTitle
);
236 BOOL bWeb
= 0 != PTR_CAST(SwWebView
, this);
237 nMergeType
= pMgr
->GetMergeType();
241 SwView::MakeOptions( pDlg
, aOpts
, &bPrtPros
, &bPrtPros_RTL
, bWeb
, GetPrinter(),
242 pSh
->getIDocumentDeviceAccess()->getPrintData() );
244 //set the appropriate view options to print
245 //on silent mode the field commands have to be switched off always
246 //on default print the user is asked what to do
247 const SwViewOption
* pCurrentViewOptions
= pSh
->GetViewOptions();
248 bool bSwitchOff_IsFldName
= pCurrentViewOptions
->IsFldName() && pSh
->IsAnyFieldInDoc();
250 if(!bSilent
&& bSwitchOff_IsFldName
)
252 QueryBox
aBox( &GetEditWin(), SW_RES( DLG_PRT_FIELDNAME
) );
253 USHORT nRet
= aBox
.Execute();
254 if( RET_CANCEL
== nRet
)
255 return ERRCODE_IO_ABORT
;
256 // disable field commands
259 bSwitchOff_IsFldName
= false;
262 bool bApplyViewOptions
= bSwitchOff_IsFldName
;
263 //switch off display of hidden characters if on and hidden characters are in use
264 const sal_Bool bOldShowHiddenChar
= pCurrentViewOptions
->IsShowHiddenChar();
265 const sal_Bool bOldMetaChars
= pCurrentViewOptions
->IsViewMetaChars();
266 if( bOldShowHiddenChar
!= aOpts
.IsPrintHiddenText()
267 && pSh
->GetDoc()->ContainsHiddenChars())
268 bApplyViewOptions
|= true;
269 //switch off display of hidden paragraphs if on and hidden paragraphs are in use
270 const sal_Bool bOldShowHiddenPara
= pCurrentViewOptions
->IsShowHiddenPara();
271 if( aOpts
.IsPrintHiddenText() != bOldShowHiddenPara
)
273 const SwFieldType
* pFldType
= pSh
->GetDoc()->GetSysFldType(RES_HIDDENPARAFLD
);
274 if( pFldType
&& pFldType
->GetDepends())
275 bApplyViewOptions
|= true;
277 const sal_Bool bOldShowHiddenField
= pCurrentViewOptions
->IsShowHiddenField();
278 if( aOpts
.IsPrintHiddenText() != bOldShowHiddenField
)
280 const SwFieldType
* pFldType
= pSh
->GetDoc()->GetSysFldType(RES_HIDDENTXTFLD
);
281 if( pFldType
|| pFldType
->GetDepends())
282 bApplyViewOptions
|= true;
285 SwViewOption
* pOrgViewOption
= 0;
286 bApplyViewOptions
|= !aOpts
.IsPrintTextPlaceholder();
287 if(bApplyViewOptions
)
289 pOrgViewOption
= new SwViewOption(*pSh
->GetViewOptions());
290 if(bSwitchOff_IsFldName
)
291 pOrgViewOption
->SetFldName(aOpts
.IsPrintHiddenText());
293 pOrgViewOption
->SetShowHiddenChar(aOpts
.IsPrintHiddenText());
294 pOrgViewOption
->SetViewMetaChars(sal_True
);
295 pOrgViewOption
->SetShowHiddenPara(aOpts
.IsPrintHiddenText());
296 pOrgViewOption
->SetShowHiddenField(aOpts
.IsPrintHiddenText());
297 pOrgViewOption
->SetShowPlaceHolderFields( aOpts
.bPrintTextPlaceholder
);
299 SW_MOD()->ApplyUsrPref(*pOrgViewOption
, this, VIEWOPT_DEST_VIEW_ONLY
);
302 if( nMergeType
== DBMGR_MERGE_MAILMERGE
||
303 DBMGR_MERGE_DOCUMENTS
== nMergeType
)
305 if(DBMGR_MERGE_DOCUMENTS
== nMergeType
)
306 bStartJob
= pMgr
->MergePrintDocuments( *this, aOpts
, *pProgress
, bIsAPI
);
308 bStartJob
= pMgr
->MergePrint( *this, aOpts
, *pProgress
, bIsAPI
);
312 const BOOL bLockedView
= pSh
->IsViewLocked();
313 pSh
->LockView( TRUE
);
315 //BrowseView abschalten und die View gegen alle Paints locken.
316 BOOL bBrowse
= pSh
->getIDocumentSettingAccess()->get(IDocumentSettingAccess::BROWSE_MODE
);
317 SfxAllItemSet
aSet( SFX_APP()->GetPool() );
318 SfxBoolItem
aBrowse( SID_BROWSER_MODE
, FALSE
);
322 pSh
->GetWin()->Update();
324 aSet
.Put( aBrowse
, aBrowse
.Which() );
325 SfxRequest
aReq( SID_BROWSER_MODE
, 0, aSet
);
326 GetDocShell()->Execute( aReq
);
329 // die Felder aktualisieren
330 BOOL bIsModified
= pSh
->IsModified();
331 pSh
->StartAllAction();
333 pSh
->UpdateDocStat( aDocStat
);
334 pSh
->EndAllTblBoxEdit();
335 pSh
->ViewShell::UpdateFlds(TRUE
);
336 if( pSh
->IsCrsrInTbl() )
338 pSh
->ClearTblBoxCntnt();
339 pSh
->SaveTblBoxCntnt();
344 pSh
->ResetModified();
346 if( -1 != bPrintSelection
)
347 aOpts
.bPrintSelection
= 0 != bPrintSelection
;
349 uno::Sequence
< beans::PropertyValue
> aViewProperties(18);
350 beans::PropertyValue
* pViewProperties
= aViewProperties
.getArray();
351 pViewProperties
[1].Name
= C2U("PrintGraphics");
352 pViewProperties
[1].Value
<<= (sal_Bool
)aOpts
.IsPrintGraphic();
353 pViewProperties
[2].Name
= C2U("PrintTables");
354 pViewProperties
[2].Value
<<= (sal_Bool
)aOpts
.IsPrintTable();
355 pViewProperties
[3].Name
= C2U("PrintDrawings");
356 pViewProperties
[3].Value
<<= (sal_Bool
)aOpts
.IsPrintDraw();
357 pViewProperties
[4].Name
= C2U("PrintLeftPages");
358 pViewProperties
[4].Value
<<= (sal_Bool
)aOpts
.IsPrintLeftPage();
359 pViewProperties
[5].Name
= C2U("PrintRightPages");
360 pViewProperties
[5].Value
<<= (sal_Bool
)aOpts
.IsPrintRightPage();
361 pViewProperties
[6].Name
= C2U("PrintControls");
362 pViewProperties
[6].Value
<<= (sal_Bool
)aOpts
.IsPrintControl();
363 pViewProperties
[7].Name
= C2U("PrintReversed");
364 pViewProperties
[7].Value
<<= (sal_Bool
)aOpts
.IsPrintReverse();
365 pViewProperties
[8].Name
= C2U("PrintPaperFromSetup");
366 pViewProperties
[8].Value
<<= (sal_Bool
)aOpts
.IsPaperFromSetup();
367 pViewProperties
[9].Name
= C2U("PrintFaxName");
368 pViewProperties
[9].Value
<<= aOpts
.GetFaxName();
369 pViewProperties
[10].Name
= C2U("PrintAnnotationMode");
370 pViewProperties
[10].Value
<<= (text::NotePrintMode
) aOpts
.GetPrintPostIts();
371 pViewProperties
[11].Name
= C2U("PrintProspect");
372 pViewProperties
[11].Value
<<= (sal_Bool
)aOpts
.IsPrintProspect();
373 pViewProperties
[12].Name
= C2U("PrintPageBackground");
374 pViewProperties
[12].Value
<<= (sal_Bool
)aOpts
.IsPrintPageBackground();
375 pViewProperties
[13].Name
= C2U("PrintBlackFonts");
376 pViewProperties
[13].Value
<<= (sal_Bool
)aOpts
.IsPrintBlackFont();
377 pViewProperties
[0].Name
= C2U("IsSinglePrintJob");
378 pViewProperties
[0].Value
<<= (sal_Bool
)aOpts
.IsPrintSingleJobs();
379 pViewProperties
[14].Name
= C2U("Selection");
380 pViewProperties
[14].Value
<<= (sal_Bool
)aOpts
.bPrintSelection
;
381 pViewProperties
[15].Name
= C2U("PrintEmptyPages");
382 pViewProperties
[15].Value
<<= (sal_Bool
)aOpts
.bPrintEmptyPages
;
383 pViewProperties
[16].Name
= C2U("PrintHiddenText");
384 pViewProperties
[16].Value
<<= (sal_Bool
)aOpts
.bPrintHiddenText
;
385 pViewProperties
[17].Name
= C2U("PrintTextPlaceholder");
386 pViewProperties
[17].Value
<<= (sal_Bool
)aOpts
.bPrintTextPlaceholder
;
387 SetAdditionalPrintOptions(aViewProperties
);
389 SfxViewShell::Print(*pProgress
, bIsAPI
);
390 if ( !pProgress
->IsAborted() )
394 bStartJob
= pPrinter
->StartJob( aOpts
.GetJobName() );
396 pSh
->PrintProspect( aOpts
, *pProgress
, bPrtPros_RTL
);
399 bStartJob
= pSh
->Prt( aOpts
, pProgress
);
403 aBrowse
.SetValue( TRUE
);
404 aSet
.Put( aBrowse
, aBrowse
.Which() );
405 SfxRequest
aReq( SID_BROWSER_MODE
, 0, aSet
);
406 GetDocShell()->Execute( aReq
);
413 pSh
->LockView( bLockedView
);
417 if(bSwitchOff_IsFldName
)
418 pOrgViewOption
->SetFldName(TRUE
);
419 pOrgViewOption
->SetShowHiddenChar(bOldShowHiddenChar
);
420 pOrgViewOption
->SetViewMetaChars(bOldMetaChars
);
421 pOrgViewOption
->SetShowHiddenField(bOldShowHiddenField
);
422 pOrgViewOption
->SetShowHiddenPara(bOldShowHiddenPara
);
423 //must to be set to sal_True anyway
424 pOrgViewOption
->SetShowPlaceHolderFields( sal_True
);
425 SW_MOD()->ApplyUsrPref(*pOrgViewOption
, this, VIEWOPT_DEST_VIEW_ONLY
);
426 delete pOrgViewOption
;
432 // Printer konnte nicht gestartet werden
434 return pPrinter
->GetError();
438 if ( pPrinter
->IsJobActive() )
440 pProgress
->DeleteOnEndPrint();
442 return pPrinter
->GetError();
446 // the next call might destroy pPrinter (in case it is not the usual document printer); so get the error before
447 ULONG nError
= pPrinter
->GetError();
448 pProgress
->DeleteOnEndPrint();
455 /*--------------------------------------------------------------------
456 Beschreibung: TabPage fuer applikationsspezifische Druckoptionen
457 --------------------------------------------------------------------*/
459 SfxTabPage
* __EXPORT
SwView::CreatePrintOptionsPage(Window
* pParent
,
460 const SfxItemSet
& rSet
)
462 return ::CreatePrintOptionsPage( pParent
, rSet
, FALSE
);
465 /*--------------------------------------------------------------------
466 Beschreibung: Druckerdialog
467 --------------------------------------------------------------------*/
469 PrintDialog
* CreatePrintDialog( Window
* pParent
, USHORT nPg
, SwWrtShell
* pSh
)
471 PrintDialog
*pDlg
= new PrintDialog( pParent
, false );
472 // pDlg->ChangeFirstPage( 1 );
476 // pDlg->ChangeLastPage( nPg );
477 // pDlg->ChangeMaxPage( 9999 );
478 pDlg
->EnableRange( PRINTDIALOG_FROMTO
);
480 if (pSh
&& (pSh
->IsSelection() || pSh
->IsFrmSelected() || pSh
->IsObjSelected()))
481 pDlg
->EnableRange( PRINTDIALOG_SELECTION
);
483 pDlg
->SetRangeText( String::CreateFromInt32(nPg
) );
484 pDlg
->EnableRange( PRINTDIALOG_RANGE
);
485 pDlg
->EnableCollate();
489 /*--------------------------------------------------------------------
491 --------------------------------------------------------------------*/
493 PrintDialog
* __EXPORT
SwView::CreatePrintDialog( Window
* pParent
)
495 // AMA: Hier sollte vielleicht die virtuelle Seitennummer angezeigt werden,
496 // aber nur, wenn das Drucken virtuelle Seitennummern und nicht wie
497 // bisher (auch beim SWG 2.0) physikalische beachtet werden.
498 return ::CreatePrintDialog( pParent
, GetWrtShell().GetPhyPageNum(), &GetWrtShell() );
501 /*--------------------------------------------------------------------
502 Beschreibung: Print-Dispatcher
503 --------------------------------------------------------------------*/
505 void __EXPORT
SwView::ExecutePrint(SfxRequest
& rReq
)
507 BOOL bWeb
= 0 != PTR_CAST(SwWebView
, this);
508 ::SetAppPrintOptions( &GetWrtShell(), bWeb
);
509 switch (rReq
.GetSlot())
513 SwPrintOptions
* pPrintOptions
= SW_MOD()->GetPrtOptions(bWeb
);
514 String
sFaxName(pPrintOptions
->GetFaxName());
517 SfxStringItem
aPrinterName(SID_PRINTER_NAME
, sFaxName
);
518 SfxBoolItem
aSilent( SID_SILENT
, TRUE
);
519 GetViewFrame()->GetDispatcher()->Execute( SID_PRINTDOC
,
520 SFX_CALLMODE_SYNCHRON
|SFX_CALLMODE_RECORD
,
521 &aPrinterName
, &aSilent
, 0L );
525 InfoBox
aInfoBox(&GetEditWin(), SW_RES(MSG_ERR_NO_FAX
));
526 String sMsg
= aInfoBox
.GetMessText();
527 USHORT nResNo
= bWeb
? STR_WEBOPTIONS
: STR_TEXTOPTIONS
;
528 sMsg
.SearchAndReplace(String::CreateFromAscii("%1"), String(SW_RES(nResNo
)));
529 aInfoBox
.SetMessText(sMsg
);
531 SfxUInt16Item
aDefPage(SID_SW_EDITOPTIONS
, TP_OPTPRINT_PAGE
);
532 GetViewFrame()->GetDispatcher()->Execute(SID_SW_EDITOPTIONS
,
533 SFX_CALLMODE_SYNCHRON
|SFX_CALLMODE_RECORD
,
539 case SID_PRINTDOCDIRECT
:
541 SwWrtShell
* pSh
= &GetWrtShell();
542 SFX_REQUEST_ARG(rReq
, pSilentItem
, SfxBoolItem
, SID_SILENT
, FALSE
);
543 BOOL bSilent
= pSilentItem
? pSilentItem
->GetValue() : FALSE
;
544 SFX_REQUEST_ARG(rReq
, pPrintFromMergeItem
, SfxBoolItem
, FN_QRY_MERGE
, FALSE
);
545 if(pPrintFromMergeItem
)
546 rReq
.RemoveItem(FN_QRY_MERGE
);
547 BOOL bFromMerge
= pPrintFromMergeItem
? pPrintFromMergeItem
->GetValue() : FALSE
;
548 SwMiscConfig aMiscConfig
;
549 if(!bSilent
&& !bFromMerge
&&
550 SW_MOD()->GetModuleConfig()->IsAskForMailMerge() && pSh
->IsAnyDatabaseFieldInDoc())
552 QueryBox
aBox( &GetEditWin(), SW_RES( MSG_PRINT_AS_MERGE
));
553 short nRet
= aBox
.Execute();
556 SfxBoolItem
aBool(FN_QRY_MERGE
, TRUE
);
557 GetViewFrame()->GetDispatcher()->Execute(
558 FN_QRY_MERGE
, SFX_CALLMODE_ASYNCHRON
, &aBool
, 0L);
563 //#i61455# if master documentes are printed silently without loaded links then update the links now
564 if( bSilent
&& pSh
->IsGlobalDoc() && !pSh
->IsGlblDocSaveLinks() )
566 pSh
->GetLinkManager().UpdateAllLinks( sal_False
, sal_False
, sal_False
, 0 );
568 SfxViewShell::ExecuteSlot( rReq
, SfxViewShell::GetInterface() );
572 ASSERT(!this, falscher Dispatcher
);
577 /*--------------------------------------------------------------------
578 Beschreibung: Page Drucker/Zusaetze erzeugen fuer SwView und
580 --------------------------------------------------------------------*/
582 SfxTabPage
* CreatePrintOptionsPage( Window
*pParent
,
583 const SfxItemSet
&rOptions
, BOOL bPreview
)
585 SfxTabPage
* pPage
= NULL
;
586 SwAbstractDialogFactory
* pFact
= SwAbstractDialogFactory::Create();
589 ::CreateTabPage fnCreatePage
= pFact
->GetTabPageCreatorFunc( TP_OPTPRINT_PAGE
);
591 pPage
= (*fnCreatePage
)( pParent
, rOptions
);
593 SfxAllItemSet
aSet(*(rOptions
.GetPool()));
594 aSet
.Put (SfxBoolItem(SID_PREVIEWFLAG_TYPE
, bPreview
));
595 aSet
.Put (SfxBoolItem(SID_FAX_LIST
, sal_True
));
596 pPage
->PageCreated(aSet
);
601 void SetAppPrintOptions( ViewShell
* pSh
, BOOL bWeb
)
603 SwPrintData aPrtData
= *SW_MOD()->GetPrtOptions(bWeb
);
604 const IDocumentDeviceAccess
* pIDDA
= pSh
->getIDocumentDeviceAccess();
605 SwPrintData
* pShellPrintData
= pIDDA
->getPrintData();
608 aPrtData
= *pShellPrintData
;
610 if( pIDDA
->getPrinter( false ) )
612 // Applikationseigene Druckoptionen in SfxPrinter schiessen
613 SwAddPrinterItem
aAddPrinterItem (FN_PARAM_ADDPRINTER
, aPrtData
);
614 SfxItemSet
aSet( pSh
->GetAttrPool(),
615 FN_PARAM_ADDPRINTER
, FN_PARAM_ADDPRINTER
,
616 SID_HTML_MODE
, SID_HTML_MODE
,
617 SID_PRINTER_NOTFOUND_WARN
, SID_PRINTER_NOTFOUND_WARN
,
618 SID_PRINTER_CHANGESTODOC
, SID_PRINTER_CHANGESTODOC
,
621 SfxMiscCfg
* pMisc
= SFX_APP()->GetMiscConfig();
624 aSet
.Put(SfxUInt16Item(SID_HTML_MODE
,
625 ::GetHtmlMode(((SwWrtShell
*)pSh
)->GetView().GetDocShell())));
626 aSet
.Put(SfxBoolItem(SID_PRINTER_NOTFOUND_WARN
,
627 pMisc
->IsNotFoundWarning() ));
628 aSet
.Put(aAddPrinterItem
);
629 aSet
.Put( SfxFlagItem( SID_PRINTER_CHANGESTODOC
,
630 (pMisc
->IsPaperSizeWarning() ? SFX_PRINTER_CHG_SIZE
: 0) |
631 (pMisc
->IsPaperOrientationWarning() ? SFX_PRINTER_CHG_ORIENTATION
: 0 )));
633 pIDDA
->getPrinter( true )->SetOptions( aSet
);