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: PrintManager.hxx,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 ************************************************************************/
30 #ifndef SD_PRINT_MANAGER_HXX
31 #define SD_PRINT_MANAGER_HXX
34 #include <tools/solar.h>
35 #include <tools/errcode.hxx>
36 #include <sfx2/viewsh.hxx>
41 class SdOptionsPrintItem
;
57 /** Manage the printing of documents.
58 This includes functions about asking the user for specific
59 information what to print as well as high to medium level printing.
64 /* Create a new print manager for the given view shell.
66 The life time of that view shell has to exceed that of the
69 PrintManager (ViewShellBase
& rViewShell
);
70 virtual ~PrintManager (void);
72 /// Forwarded to the document shell.
73 virtual SfxPrinter
* GetPrinter (BOOL bCreate
= FALSE
);
74 /// Forwarded to the main sub-shell.
75 virtual USHORT
SetPrinter (
76 SfxPrinter
* pNewPrinter
,
77 USHORT nDiffFlags
= SFX_PRINTER_ALL
, bool bIsAPI
=false);
78 /// Forwarded to the main sub-shell.
79 virtual PrintDialog
* CreatePrintDialog (::Window
*pParent
);
81 /** Create an options tab page for the curren document.
83 virtual SfxTabPage
* CreatePrintOptionsPage (
85 const SfxItemSet
&rOptions
);
87 /** Print the document.
89 The dialog specifies what to print.
91 virtual USHORT
Print (SfxProgress
& rProgress
, BOOL bIsAPI
, PrintDialog
* pDialog
);
93 /** Show a dialog that allows the user to select the print range
94 (among other things) before starting the actual printing.
96 virtual ErrCode
DoPrint (
98 PrintDialog
*pPrintDialog
,
99 BOOL bSilent
, BOOL bIsAPI
);
101 /** When called with <TRUE/> then printing is restricted to the
102 selected pages. Otherwise all pages are printed. Note that
103 you have to set the page range with a call to
104 SetPrintingPageRange().
106 void RestrictPrintingToSelection (bool bFlag
);
108 /** Set the range of the pages to print. This is taken into
109 account only after a previous call to
110 RestrictPrintingToSelection() with <TRUE/> as argument.
112 void SetPrintingPageRange (const String
& rsPageRange
);
114 USHORT
SetPrinterOptDlg (
115 SfxPrinter
* pNewPrinter
,
116 USHORT nDiffFlags
= SFX_PRINTER_ALL
,
117 BOOL _bShowDialog
= TRUE
);
119 void PreparePrint (PrintDialog
* pPrintDialog
= 0);
122 ViewShellBase
& mrBase
;
124 bool mbPrintDirectSelected
;
128 /// Copy constructor not supported.
129 PrintManager (const PrintManager
&);
131 /// Assignment operator not supported.
132 PrintManager
& operator= (const PrintManager
&);
134 /** Make sure that the pages that are to be printed do fit to the
135 printer pages. When the internal pages are larger then the printer
136 pages and no method of resolution has yet been provided then a
137 dialog is opened that asks for one. These methods are
138 a) scale internal page down to the printer page,
139 b) crop internal page
140 c) print internal page on several printer pages.
142 The printer to print the pages on that are specified by the
145 This flag, when set, tells the method not to wait for user
146 input, i.e. show a dialog.
148 The returned flag indicates whether the method was successfull (<TRUE/>)
149 or whether the printing has to be aborted (<FALSE/>). The later
150 one is the case only when the dialog is shown and the user
153 bool FitPageToPrinterWithDialog (
154 SfxPrinter
*pPrinter
,
159 /** Print outline pages.
165 /** Print handout pages.
171 /** Print slides or notes pages.
173 void PrintStdOrNotes (
177 BOOL bPrintMarkedOnly
);
179 /** Print a part of the given page that is specified by the given page
180 origin and the size of the printable area. This method is used
181 primarily when the page to print is larger than the printable area
182 and the page is printed in several parts.
187 DrawView
& rPrintView
,
188 const Point
& rPageOrigin
,
189 BOOL bPrintMarkedOnly
,
190 const String
& rsPageString
,
191 const Point
& rStringOffset
);
193 /** This method is similar to PrintPagePart() and should be unified with
198 ::sd::View
* pPrintView
,
200 BOOL bPrintMarkedOnly
);
202 /** Return <TRUE/> when the document pages have the 'Screen' size. Only
203 the first page of the document is used to determine the size.
205 bool IsScreenFormat (void);
207 /** creates the needed shapes on the handout page for the given layout */
208 void InitHandoutTemplate( PrintInfo
& rInfo
, USHORT nSlidesPerHandout
, BOOL bHandoutHorizontal
);
211 } // end of namespace sd