update dev300-m58
[ooovba.git] / sd / source / ui / inc / PrintManager.hxx
blob7d6dae3cfc1b1d676e15d1c6f8aaada5e0f7172f
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: PrintManager.hxx,v $
10 * $Revision: 1.10 $
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
33 #include "pres.hxx"
34 #include <tools/solar.h>
35 #include <tools/errcode.hxx>
36 #include <sfx2/viewsh.hxx>
38 class Font;
39 class MultiSelection;
40 class PrintDialog;
41 class SdOptionsPrintItem;
42 class SdPage;
43 class String;
44 class SfxItemSet;
45 class SfxPrinter;
46 class SfxProgress;
47 class SfxTabPage;
48 class Window;
50 namespace sd {
52 class DrawView;
53 class View;
54 class ViewShell;
55 class ViewShellBase;
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.
61 class PrintManager
63 public:
64 /* Create a new print manager for the given view shell.
65 @param rViewShell
66 The life time of that view shell has to exceed that of the
67 print manager.
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 (
84 ::Window *pParent,
85 const SfxItemSet &rOptions);
87 /** Print the document.
88 @param pDialog
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 (
97 SfxPrinter *pPrinter,
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);
121 private:
122 ViewShellBase& mrBase;
124 bool mbPrintDirectSelected;
126 String msPageRange;
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.
141 @param pPrinter
142 The printer to print the pages on that are specified by the
143 msPageRange member.
144 @param bSilent
145 This flag, when set, tells the method not to wait for user
146 input, i.e. show a dialog.
147 @return
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
151 selects 'Cancel'.
153 bool FitPageToPrinterWithDialog (
154 SfxPrinter *pPrinter,
155 bool bSilent);
157 class PrintInfo;
159 /** Print outline pages.
161 void PrintOutline (
162 PrintInfo& rInfo,
163 USHORT nPage);
165 /** Print handout pages.
167 void PrintHandout (
168 PrintInfo& rInfo,
169 USHORT nPage);
171 /** Print slides or notes pages.
173 void PrintStdOrNotes (
174 PrintInfo& rInfo,
175 USHORT nPage,
176 PageKind ePageKind,
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.
184 void PrintPagePart (
185 PrintInfo& rInfo,
186 SdPage* pPage,
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
194 that.
196 void PrintPage(
197 PrintInfo& rInfo,
198 ::sd::View* pPrintView,
199 SdPage* pPage,
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
213 #endif