xref: /AOO41X/main/sw/inc/pagepreviewlayout.hxx (revision cdf0e10c4e3984b49a9502b011690b615761d4a3)
1*cdf0e10cSrcweir #ifndef _PAGEPREVIEWLAYOUT_HXX
2*cdf0e10cSrcweir #define _PAGEPREVIEWLAYOUT_HXX
3*cdf0e10cSrcweir 
4*cdf0e10cSrcweir // template class <std::vector>
5*cdf0e10cSrcweir #include <vector>
6*cdf0e10cSrcweir // datatypes sal_xyz
7*cdf0e10cSrcweir #include <sal/types.h>
8*cdf0e10cSrcweir // classes <Point>, <Size> and <Rectangle>
9*cdf0e10cSrcweir #include <tools/gen.hxx>
10*cdf0e10cSrcweir // datatype <SwTwips>
11*cdf0e10cSrcweir #include <swtypes.hxx>
12*cdf0e10cSrcweir 
13*cdf0e10cSrcweir class ViewShell;
14*cdf0e10cSrcweir class SwRootFrm;
15*cdf0e10cSrcweir class SwPageFrm;
16*cdf0e10cSrcweir class Fraction;
17*cdf0e10cSrcweir struct PrevwPage;
18*cdf0e10cSrcweir 
19*cdf0e10cSrcweir // =============================================================================
20*cdf0e10cSrcweir /** page preview functionality in the writer
21*cdf0e10cSrcweir 
22*cdf0e10cSrcweir     OD 11.12.2002 #103492# - class <SwPagePreviewLayout>
23*cdf0e10cSrcweir 
24*cdf0e10cSrcweir     @author OD
25*cdf0e10cSrcweir */
26*cdf0e10cSrcweir class SwPagePreviewLayout
27*cdf0e10cSrcweir {
28*cdf0e10cSrcweir private:
29*cdf0e10cSrcweir     friend class ViewShell;
30*cdf0e10cSrcweir 
31*cdf0e10cSrcweir     // number of horizontal and vertical twips for spacing between the pages.
32*cdf0e10cSrcweir     const SwTwips mnXFree;
33*cdf0e10cSrcweir     const SwTwips mnYFree;
34*cdf0e10cSrcweir 
35*cdf0e10cSrcweir     // view shell the print preview is generated for.
36*cdf0e10cSrcweir     ViewShell& mrParentViewShell;
37*cdf0e10cSrcweir     // top layout frame of the layout for accessing the pages
38*cdf0e10cSrcweir     const SwRootFrm& mrLayoutRootFrm;
39*cdf0e10cSrcweir 
40*cdf0e10cSrcweir     // boolean indicating, if the layout information (number of columns and rows)
41*cdf0e10cSrcweir     // are valid.
42*cdf0e10cSrcweir     bool        mbLayoutInfoValid;
43*cdf0e10cSrcweir     // boolean indicating, if the the calculated print preview layout sizes
44*cdf0e10cSrcweir     // ( windows size in twips, maximal page size, column width, row height,
45*cdf0e10cSrcweir     //   width and height of a print preview page, size of the print preview
46*cdf0e10cSrcweir     //   document ) are valid
47*cdf0e10cSrcweir     bool        mbLayoutSizesValid;
48*cdf0e10cSrcweir     // boolean indicating, if the the paint information ( physical number of
49*cdf0e10cSrcweir     //   start page, start column and row, paint offsets, rectangle visible of
50*cdf0e10cSrcweir     //   the print preview document.
51*cdf0e10cSrcweir     bool        mbPaintInfoValid;
52*cdf0e10cSrcweir 
53*cdf0e10cSrcweir     Size        maWinSize;
54*cdf0e10cSrcweir     sal_uInt16  mnCols;
55*cdf0e10cSrcweir     sal_uInt16  mnRows;
56*cdf0e10cSrcweir     sal_uInt16  mnPages;
57*cdf0e10cSrcweir     // OD 19.02.2003 #107369# - new flag for leaving blank left-top-corner
58*cdf0e10cSrcweir     // OD 2004-03-05 #i18143# - the book preview is controlled by this flag
59*cdf0e10cSrcweir     bool        mbBookPreview;
60*cdf0e10cSrcweir     bool        mbBookPreviewModeToggled;
61*cdf0e10cSrcweir 
62*cdf0e10cSrcweir     Size        maMaxPageSize;
63*cdf0e10cSrcweir     Rectangle   maPreviewDocRect;
64*cdf0e10cSrcweir     SwTwips     mnColWidth;
65*cdf0e10cSrcweir     SwTwips     mnRowHeight;
66*cdf0e10cSrcweir     SwTwips     mnPrevwLayoutWidth;
67*cdf0e10cSrcweir     SwTwips     mnPrevwLayoutHeight;
68*cdf0e10cSrcweir     bool        mbDoesLayoutColsFitIntoWindow;
69*cdf0e10cSrcweir     bool        mbDoesLayoutRowsFitIntoWindow;
70*cdf0e10cSrcweir 
71*cdf0e10cSrcweir     sal_uInt16  mnPaintPhyStartPageNum;
72*cdf0e10cSrcweir     sal_uInt16  mnPaintStartCol;
73*cdf0e10cSrcweir     sal_uInt16  mnPaintStartRow;
74*cdf0e10cSrcweir     bool        mbNoPageVisible;
75*cdf0e10cSrcweir     Point       maPaintStartPageOffset;
76*cdf0e10cSrcweir     Point       maPaintPreviewDocOffset;
77*cdf0e10cSrcweir     Point       maAdditionalPaintOffset;
78*cdf0e10cSrcweir     Rectangle   maPaintedPrevwDocRect;
79*cdf0e10cSrcweir     sal_uInt16  mnSelectedPageNum;
80*cdf0e10cSrcweir 
81*cdf0e10cSrcweir     std::vector<PrevwPage*> maPrevwPages;
82*cdf0e10cSrcweir 
83*cdf0e10cSrcweir     // OD 07.11.2003 #i22014# - internal booleans to indicate, that a new print
84*cdf0e10cSrcweir     // preview layout has been created during a paint.
85*cdf0e10cSrcweir     mutable bool mbInPaint;
86*cdf0e10cSrcweir     mutable bool mbNewLayoutDuringPaint;
87*cdf0e10cSrcweir 
88*cdf0e10cSrcweir     bool mbPrintEmptyPages;
89*cdf0e10cSrcweir 
90*cdf0e10cSrcweir     /** clear internal data about current page preview
91*cdf0e10cSrcweir 
92*cdf0e10cSrcweir         OD 11.12.2002 #103492#
93*cdf0e10cSrcweir 
94*cdf0e10cSrcweir         @author OD
95*cdf0e10cSrcweir     */
96*cdf0e10cSrcweir     void _Clear();
97*cdf0e10cSrcweir 
98*cdf0e10cSrcweir     /** helper method to clear preview page layout sizes
99*cdf0e10cSrcweir 
100*cdf0e10cSrcweir         OD 18.12.2002 #103492#
101*cdf0e10cSrcweir 
102*cdf0e10cSrcweir         @author OD
103*cdf0e10cSrcweir     */
104*cdf0e10cSrcweir     void _ClearPrevwLayoutSizes();
105*cdf0e10cSrcweir 
106*cdf0e10cSrcweir     /** helper method to clear data in preview page vectors
107*cdf0e10cSrcweir 
108*cdf0e10cSrcweir         OD 13.12.2002 #103492#
109*cdf0e10cSrcweir 
110*cdf0e10cSrcweir         @author OD
111*cdf0e10cSrcweir     */
112*cdf0e10cSrcweir     void _ClearPrevwPageData();
113*cdf0e10cSrcweir 
114*cdf0e10cSrcweir     /** calculate page preview layout sizes
115*cdf0e10cSrcweir 
116*cdf0e10cSrcweir         OD 18.12.2002 #103492#
117*cdf0e10cSrcweir 
118*cdf0e10cSrcweir         @author OD
119*cdf0e10cSrcweir     */
120*cdf0e10cSrcweir     void _CalcPrevwLayoutSizes();
121*cdf0e10cSrcweir 
122*cdf0e10cSrcweir     /** apply new zoom at given view shell
123*cdf0e10cSrcweir 
124*cdf0e10cSrcweir         OD 11.12.2002 #103492#
125*cdf0e10cSrcweir 
126*cdf0e10cSrcweir         @author OD
127*cdf0e10cSrcweir 
128*cdf0e10cSrcweir         @param _aNewZoom
129*cdf0e10cSrcweir         input parameter - new zoom percentage
130*cdf0e10cSrcweir     */
131*cdf0e10cSrcweir     void _ApplyNewZoomAtViewShell( sal_uInt8 _aNewZoom );
132*cdf0e10cSrcweir 
133*cdf0e10cSrcweir     /** calculate additional paint offset
134*cdf0e10cSrcweir 
135*cdf0e10cSrcweir         OD 12.12.2002 #103492#
136*cdf0e10cSrcweir         helper method called by <Prepare> in order to calculate an additional
137*cdf0e10cSrcweir         paint offset to center output in given window size.
138*cdf0e10cSrcweir         The booleans <mbDoesLayoutRowsFitIntoWindow> and <mbDoesLayoutColsFitIntoWindow>
139*cdf0e10cSrcweir         are also determined.
140*cdf0e10cSrcweir         preconditions:
141*cdf0e10cSrcweir         (1) preview layout is given (number of rows and columns).
142*cdf0e10cSrcweir         (2) window size is given.
143*cdf0e10cSrcweir         (3) height of row and width of column are calculated.
144*cdf0e10cSrcweir         (4) paint offset of start page is calculated.
145*cdf0e10cSrcweir 
146*cdf0e10cSrcweir         @author OD
147*cdf0e10cSrcweir     */
148*cdf0e10cSrcweir     void _CalcAdditionalPaintOffset();
149*cdf0e10cSrcweir 
150*cdf0e10cSrcweir     /** calculate painted preview document rectangle
151*cdf0e10cSrcweir 
152*cdf0e10cSrcweir         OD 12.12.2002 #103492#
153*cdf0e10cSrcweir         helper method called by <Prepare> in order to calculate the rectangle,
154*cdf0e10cSrcweir         which will be painted for the document arranged by the given preview
155*cdf0e10cSrcweir         layout.
156*cdf0e10cSrcweir         preconditions:
157*cdf0e10cSrcweir         (1) paint offset of document preview is calculated.
158*cdf0e10cSrcweir         (2) size of document preview is calculated.
159*cdf0e10cSrcweir         (3) additional paint offset is calculated - see <_CalcAdditionalPaintOffset>.
160*cdf0e10cSrcweir 
161*cdf0e10cSrcweir         @author OD
162*cdf0e10cSrcweir     */
163*cdf0e10cSrcweir     void _CalcDocPrevwPaintRect();
164*cdf0e10cSrcweir 
165*cdf0e10cSrcweir     /** determines preview data for a given page and a given preview offset
166*cdf0e10cSrcweir 
167*cdf0e10cSrcweir         OD 13.12.2002 #103492#
168*cdf0e10cSrcweir 
169*cdf0e10cSrcweir         @author OD
170*cdf0e10cSrcweir 
171*cdf0e10cSrcweir         @param _rPage
172*cdf0e10cSrcweir         input parameter - constant reference to page frame, for which the
173*cdf0e10cSrcweir         preview data will be calculated.
174*cdf0e10cSrcweir 
175*cdf0e10cSrcweir         @param _rPrevwOffset
176*cdf0e10cSrcweir         input parameter - constant reference to the offset the given page has
177*cdf0e10cSrcweir         in the current preview window.
178*cdf0e10cSrcweir         Note: Offset can be negative.
179*cdf0e10cSrcweir 
180*cdf0e10cSrcweir         @param _opPrevwPage
181*cdf0e10cSrcweir         output parameter - calculated preview data.
182*cdf0e10cSrcweir 
183*cdf0e10cSrcweir         @return boolean, indicating, if calculation was successful.
184*cdf0e10cSrcweir     */
185*cdf0e10cSrcweir     bool _CalcPreviewDataForPage( const SwPageFrm& _rPage,
186*cdf0e10cSrcweir                                   const Point& _rPrevwOffset,
187*cdf0e10cSrcweir                                   PrevwPage* _opPrevwPage );
188*cdf0e10cSrcweir 
189*cdf0e10cSrcweir     /** calculate preview pages
190*cdf0e10cSrcweir 
191*cdf0e10cSrcweir         OD 12.12.2002 #103492#
192*cdf0e10cSrcweir         helper method called by <Prepare> in order to determine which pages
193*cdf0e10cSrcweir         will be visible in the current preview and calculate the data needed
194*cdf0e10cSrcweir         to paint these pages. Also the accessible pages with its needed data
195*cdf0e10cSrcweir         are determined.
196*cdf0e10cSrcweir 
197*cdf0e10cSrcweir         @author OD
198*cdf0e10cSrcweir     */
199*cdf0e10cSrcweir     void _CalcPreviewPages();
200*cdf0e10cSrcweir 
201*cdf0e10cSrcweir     /** get preview page by physical page number
202*cdf0e10cSrcweir 
203*cdf0e10cSrcweir         OD 17.12.2002 #103492#
204*cdf0e10cSrcweir 
205*cdf0e10cSrcweir         @author OD
206*cdf0e10cSrcweir 
207*cdf0e10cSrcweir         @param _nPageNum
208*cdf0e10cSrcweir         input parameter - physical page number of page, for which the preview
209*cdf0e10cSrcweir         page will be returned.
210*cdf0e10cSrcweir 
211*cdf0e10cSrcweir         @return pointer to preview page of current preview pages. If page doesn't
212*cdf0e10cSrcweir         belongs to current preview pages, <0> is returned.
213*cdf0e10cSrcweir     */
214*cdf0e10cSrcweir     const PrevwPage* _GetPrevwPageByPageNum( const sal_uInt16 _nPageNum ) const;
215*cdf0e10cSrcweir 
216*cdf0e10cSrcweir     /** paint selection mark at page
217*cdf0e10cSrcweir 
218*cdf0e10cSrcweir         OD 17.12.2002 #103492#
219*cdf0e10cSrcweir 
220*cdf0e10cSrcweir         @author OD
221*cdf0e10cSrcweir     */
222*cdf0e10cSrcweir     void _PaintSelectMarkAtPage( const PrevwPage* _aSelectedPrevwPage ) const;
223*cdf0e10cSrcweir 
224*cdf0e10cSrcweir public:
225*cdf0e10cSrcweir     /** constructor of <SwPagePreviewLayout>
226*cdf0e10cSrcweir 
227*cdf0e10cSrcweir         OD 11.12.2002 #103492#
228*cdf0e10cSrcweir 
229*cdf0e10cSrcweir         @author OD
230*cdf0e10cSrcweir 
231*cdf0e10cSrcweir         @param _rParentViewShell
232*cdf0e10cSrcweir         input parameter - reference to the view shell the page preview
233*cdf0e10cSrcweir         layout belongs to. Reference will be hold as member <mrParentViewShell>.
234*cdf0e10cSrcweir         Adjustments/Changes at this view shell:
235*cdf0e10cSrcweir         (1) Adjustment of the mapping mode at the output device.
236*cdf0e10cSrcweir         (2) Change of the zoom at the view options.
237*cdf0e10cSrcweir         (3) Preparations for paint of the page preview.
238*cdf0e10cSrcweir 
239*cdf0e10cSrcweir         @param _rLayoutRootFrm
240*cdf0e10cSrcweir         input parameter - constant reference to the root frame of the layout.
241*cdf0e10cSrcweir         Reference will be hold as member <mrLayoutRootFrm> in order to get
242*cdf0e10cSrcweir         access to the page frames.
243*cdf0e10cSrcweir     */
244*cdf0e10cSrcweir     SwPagePreviewLayout( ViewShell& _rParentViewShell,
245*cdf0e10cSrcweir                          const SwRootFrm&    _rLayoutRootFrm );
246*cdf0e10cSrcweir 
247*cdf0e10cSrcweir     /** destructor of <SwPagePreviewLayout>
248*cdf0e10cSrcweir 
249*cdf0e10cSrcweir         OD 17.12.2002 #103492#
250*cdf0e10cSrcweir 
251*cdf0e10cSrcweir         @author
252*cdf0e10cSrcweir     */
253*cdf0e10cSrcweir     inline ~SwPagePreviewLayout()
254*cdf0e10cSrcweir     {
255*cdf0e10cSrcweir         _ClearPrevwPageData();
256*cdf0e10cSrcweir     }
257*cdf0e10cSrcweir 
258*cdf0e10cSrcweir     /** init page preview layout
259*cdf0e10cSrcweir 
260*cdf0e10cSrcweir         OD 11.12.2002 #103492#
261*cdf0e10cSrcweir         initialize the page preview settings for a given layout.
262*cdf0e10cSrcweir         side effects:
263*cdf0e10cSrcweir         (1) If parameter <_bCalcScale> is true, mapping mode with calculated
264*cdf0e10cSrcweir         scaling is set at the output device and the zoom at the view options of
265*cdf0e10cSrcweir         the given view shell is set with the calculated scaling.
266*cdf0e10cSrcweir 
267*cdf0e10cSrcweir         @author OD
268*cdf0e10cSrcweir 
269*cdf0e10cSrcweir         @param _nCols
270*cdf0e10cSrcweir         input parameter - initial number of page columns in the preview.
271*cdf0e10cSrcweir 
272*cdf0e10cSrcweir         @param _nRows
273*cdf0e10cSrcweir         input parameter - initial number of page rows in the preview.
274*cdf0e10cSrcweir 
275*cdf0e10cSrcweir         @param _rPxWinSize
276*cdf0e10cSrcweir         input parameter - window size in which the preview will be displayed and
277*cdf0e10cSrcweir         for which the scaling will be calculated.
278*cdf0e10cSrcweir 
279*cdf0e10cSrcweir         @param _bCalcScale
280*cdf0e10cSrcweir         input parameter - control, if method should calculate the needed
281*cdf0e10cSrcweir         scaling for the proposed preview layout for the given window size
282*cdf0e10cSrcweir         and sets the scaling at the output device and the view options.
283*cdf0e10cSrcweir 
284*cdf0e10cSrcweir         @return boolean, indicating, if preview layout is successful initialized.
285*cdf0e10cSrcweir     */
286*cdf0e10cSrcweir     bool Init( const sal_uInt16 _nCols,
287*cdf0e10cSrcweir                const sal_uInt16 _nRows,
288*cdf0e10cSrcweir                const Size&      _rPxWinSize,
289*cdf0e10cSrcweir                const bool       _bCalcScale
290*cdf0e10cSrcweir               );
291*cdf0e10cSrcweir 
292*cdf0e10cSrcweir     /** method to adjust page preview layout to document changes
293*cdf0e10cSrcweir 
294*cdf0e10cSrcweir         OD 18.12.2002 #103492#
295*cdf0e10cSrcweir 
296*cdf0e10cSrcweir         @author OD
297*cdf0e10cSrcweir 
298*cdf0e10cSrcweir         @return boolean, indicating, if preview layout is successful initialized.
299*cdf0e10cSrcweir     */
300*cdf0e10cSrcweir     bool ReInit();
301*cdf0e10cSrcweir 
302*cdf0e10cSrcweir     /** prepare paint of page preview
303*cdf0e10cSrcweir 
304*cdf0e10cSrcweir         OD 12.12.2002 #103492#
305*cdf0e10cSrcweir         With the valid preview layout settings - calculated and set by method
306*cdf0e10cSrcweir         <Init(..)> - the paint of a specific part of the virtual preview
307*cdf0e10cSrcweir         document is prepared. The corresponding part is given by either
308*cdf0e10cSrcweir         a start page (parameter <_nProposedStartPageNum>) or a absolute position
309*cdf0e10cSrcweir         (parameter <_aProposedStartPoint>).
310*cdf0e10cSrcweir         The accessibility preview will also be updated via a corresponding
311*cdf0e10cSrcweir         method call.
312*cdf0e10cSrcweir         OD 21.03.2003 #108282# - delete parameter _onStartPageVirtNum
313*cdf0e10cSrcweir 
314*cdf0e10cSrcweir         @author OD
315*cdf0e10cSrcweir 
316*cdf0e10cSrcweir         @param _nProposedStartPageNum [0..<number of document pages>]
317*cdf0e10cSrcweir         input parameter - proposed number of page, which should be painted in
318*cdf0e10cSrcweir         the left-top-corner in the current output device. input parameter
319*cdf0e10cSrcweir         <_bStartWithPageAtFirstCol> influences, if proposed page is actual
320*cdf0e10cSrcweir         painted in the left-top-corner.
321*cdf0e10cSrcweir 
322*cdf0e10cSrcweir         @param _nProposedStartPos [(0,0)..<PreviewDocumentSize>]
323*cdf0e10cSrcweir         input parameter - proposed absolute position in the virtual preview
324*cdf0e10cSrcweir         document, which should be painted in the left-top-corner in the current
325*cdf0e10cSrcweir         output device.
326*cdf0e10cSrcweir 
327*cdf0e10cSrcweir         @param _rPxWinSize
328*cdf0e10cSrcweir         input parameter - pixel size of window the preview will be painted in.
329*cdf0e10cSrcweir 
330*cdf0e10cSrcweir         @param _onStartPageNum
331*cdf0e10cSrcweir         output parameter - physical number of page, which will be painted in the
332*cdf0e10cSrcweir         left-top-corner in the current output device.
333*cdf0e10cSrcweir 
334*cdf0e10cSrcweir         @param _orDocPreviewPaintRect
335*cdf0e10cSrcweir         output parameter - rectangle of preview document, which will be painted.
336*cdf0e10cSrcweir 
337*cdf0e10cSrcweir         @param _bStartWithPageAtFirstCol
338*cdf0e10cSrcweir         input parameter with default value "true" - controls, if start page
339*cdf0e10cSrcweir         is set to page in first column the proposed start page is located.
340*cdf0e10cSrcweir 
341*cdf0e10cSrcweir         @return boolean, indicating, if prepare of preview paint was successful.
342*cdf0e10cSrcweir     */
343*cdf0e10cSrcweir     bool Prepare( const sal_uInt16 _nProposedStartPageNum,
344*cdf0e10cSrcweir                   const Point      _aProposedStartPos,
345*cdf0e10cSrcweir                   const Size&      _rPxWinSize,
346*cdf0e10cSrcweir                   sal_uInt16&      _onStartPageNum,
347*cdf0e10cSrcweir                   Rectangle&       _orDocPreviewPaintRect,
348*cdf0e10cSrcweir                   const bool       _bStartWithPageAtFirstCol = true
349*cdf0e10cSrcweir                 );
350*cdf0e10cSrcweir 
351*cdf0e10cSrcweir     /** get selected page number
352*cdf0e10cSrcweir 
353*cdf0e10cSrcweir         OD 13.12.2002 #103492#
354*cdf0e10cSrcweir 
355*cdf0e10cSrcweir         @author OD
356*cdf0e10cSrcweir     */
357*cdf0e10cSrcweir     inline sal_uInt16 SelectedPage()
358*cdf0e10cSrcweir     {
359*cdf0e10cSrcweir         return mnSelectedPageNum;
360*cdf0e10cSrcweir     }
361*cdf0e10cSrcweir 
362*cdf0e10cSrcweir     /** set selected page number
363*cdf0e10cSrcweir 
364*cdf0e10cSrcweir         OD 14.01.2003 #103492#
365*cdf0e10cSrcweir 
366*cdf0e10cSrcweir         @author OD
367*cdf0e10cSrcweir     */
368*cdf0e10cSrcweir     inline void SetSelectedPage( sal_uInt16 _nSelectedPageNum )
369*cdf0e10cSrcweir     {
370*cdf0e10cSrcweir         mnSelectedPageNum = _nSelectedPageNum;
371*cdf0e10cSrcweir     }
372*cdf0e10cSrcweir 
373*cdf0e10cSrcweir     /** paint prepared preview
374*cdf0e10cSrcweir 
375*cdf0e10cSrcweir         OD 12.12.2002 #103492#
376*cdf0e10cSrcweir 
377*cdf0e10cSrcweir         @author OD
378*cdf0e10cSrcweir 
379*cdf0e10cSrcweir         @param _aOutRect
380*cdf0e10cSrcweir         input parameter - Twip rectangle of window, which should be painted.
381*cdf0e10cSrcweir 
382*cdf0e10cSrcweir         @return boolean, indicating, if paint of preview was performed
383*cdf0e10cSrcweir     */
384*cdf0e10cSrcweir     bool Paint( const Rectangle _aOutRect ) const;
385*cdf0e10cSrcweir 
386*cdf0e10cSrcweir     /** repaint pages on page preview
387*cdf0e10cSrcweir 
388*cdf0e10cSrcweir         OD 18.12.2002 #103492#
389*cdf0e10cSrcweir         method to invalidate visible pages due to changes in a different
390*cdf0e10cSrcweir         view shell.
391*cdf0e10cSrcweir 
392*cdf0e10cSrcweir         @author OD
393*cdf0e10cSrcweir     */
394*cdf0e10cSrcweir     void Repaint( const Rectangle _aInvalidCoreRect ) const;
395*cdf0e10cSrcweir 
396*cdf0e10cSrcweir     /** paint to mark new selected page
397*cdf0e10cSrcweir 
398*cdf0e10cSrcweir         OD 17.12.2002 #103492#
399*cdf0e10cSrcweir         Perform paint for current selected page in order to unmark it.
400*cdf0e10cSrcweir         Set new selected page and perform paint to mark this page.
401*cdf0e10cSrcweir 
402*cdf0e10cSrcweir         @author OD
403*cdf0e10cSrcweir 
404*cdf0e10cSrcweir         @param _nNewSelectedPage
405*cdf0e10cSrcweir         input parameter - physical number of page, which will be marked as selected.
406*cdf0e10cSrcweir     */
407*cdf0e10cSrcweir     void MarkNewSelectedPage( const sal_uInt16 _nSelectedPage );
408*cdf0e10cSrcweir 
409*cdf0e10cSrcweir     /** calculate start position for new scale
410*cdf0e10cSrcweir 
411*cdf0e10cSrcweir         OD 12.12.2002 #103492#
412*cdf0e10cSrcweir         calculate new start position for a new scale. Calculation bases on the
413*cdf0e10cSrcweir         current visible part of the document arranged in the given preview layout.
414*cdf0e10cSrcweir         preconditions:
415*cdf0e10cSrcweir         (1) new scaling is already set at the given output device.
416*cdf0e10cSrcweir 
417*cdf0e10cSrcweir         @author OD
418*cdf0e10cSrcweir 
419*cdf0e10cSrcweir         @return Point, start position for new scale
420*cdf0e10cSrcweir     */
421*cdf0e10cSrcweir     Point GetPreviewStartPosForNewScale( const Fraction& _aNewScale,
422*cdf0e10cSrcweir                                          const Fraction& _aOldScale,
423*cdf0e10cSrcweir                                          const Size&     _aNewWinSize ) const;
424*cdf0e10cSrcweir 
425*cdf0e10cSrcweir     /** determines, if page with given page number is visible in preview
426*cdf0e10cSrcweir 
427*cdf0e10cSrcweir         OD 12.12.2002 #103492#
428*cdf0e10cSrcweir 
429*cdf0e10cSrcweir         @author OD
430*cdf0e10cSrcweir 
431*cdf0e10cSrcweir         @param _nPageNum
432*cdf0e10cSrcweir         input parameter - physical number of page, for which it will be
433*cdf0e10cSrcweir         determined, if it is visible.
434*cdf0e10cSrcweir 
435*cdf0e10cSrcweir         @return boolean, indicating, if page with given page number is visible
436*cdf0e10cSrcweir         in preview.
437*cdf0e10cSrcweir     */
438*cdf0e10cSrcweir     bool IsPageVisible( const sal_uInt16 _nPageNum ) const;
439*cdf0e10cSrcweir 
440*cdf0e10cSrcweir     /** calculate data to bring new selected page into view.
441*cdf0e10cSrcweir 
442*cdf0e10cSrcweir         OD 12.12.2002 #103492#
443*cdf0e10cSrcweir 
444*cdf0e10cSrcweir         @author OD
445*cdf0e10cSrcweir 
446*cdf0e10cSrcweir         @param _nHoriMove
447*cdf0e10cSrcweir         input parameter - positive/negative number of columns the current
448*cdf0e10cSrcweir         selected page have to be moved.
449*cdf0e10cSrcweir 
450*cdf0e10cSrcweir         @param _nVertMove
451*cdf0e10cSrcweir         input parameter - positive/negative number of rows the current
452*cdf0e10cSrcweir         selected page have to be moved.
453*cdf0e10cSrcweir 
454*cdf0e10cSrcweir         @param _orNewSelectedPage
455*cdf0e10cSrcweir         output parameter - number of new selected page
456*cdf0e10cSrcweir 
457*cdf0e10cSrcweir         @param _orNewStartPage
458*cdf0e10cSrcweir         output parameter - number of new start page
459*cdf0e10cSrcweir 
460*cdf0e10cSrcweir         @param _orNewStartPos
461*cdf0e10cSrcweir         output parameter - new start position in document preview
462*cdf0e10cSrcweir 
463*cdf0e10cSrcweir         @return boolean - indicating, that move was sucessful.
464*cdf0e10cSrcweir     */
465*cdf0e10cSrcweir     bool CalcStartValuesForSelectedPageMove( const sal_Int16  _nHoriMove,
466*cdf0e10cSrcweir                                              const sal_Int16  _nVertMove,
467*cdf0e10cSrcweir                                              sal_uInt16&      _orNewSelectedPage,
468*cdf0e10cSrcweir                                              sal_uInt16&      _orNewStartPage,
469*cdf0e10cSrcweir                                              Point&           _orNewStartPos ) const;
470*cdf0e10cSrcweir 
471*cdf0e10cSrcweir     /** checks, if given position is inside a shown document page
472*cdf0e10cSrcweir 
473*cdf0e10cSrcweir         OD 17.12.2002 #103492#
474*cdf0e10cSrcweir 
475*cdf0e10cSrcweir         @author OD
476*cdf0e10cSrcweir 
477*cdf0e10cSrcweir         @param _aPrevwPos
478*cdf0e10cSrcweir         input parameter - position inside the visible preview window.
479*cdf0e10cSrcweir 
480*cdf0e10cSrcweir         @param _orDocPos
481*cdf0e10cSrcweir         output parameter - corresponding position in the document, if given
482*cdf0e10cSrcweir         preview position is inside a shown document page, not an empty page.
483*cdf0e10cSrcweir         If not, it's value is <Point( 0, 0 )>.
484*cdf0e10cSrcweir 
485*cdf0e10cSrcweir         @param _obPosInEmptyPage
486*cdf0e10cSrcweir         output parameter - indicates, that given preview position lays inside
487*cdf0e10cSrcweir         an shown empty page.
488*cdf0e10cSrcweir 
489*cdf0e10cSrcweir         @param _onPageNum
490*cdf0e10cSrcweir         output parameter - corresponding physical number of page, if given
491*cdf0e10cSrcweir         preview position is inside a shown document page, considers also empty
492*cdf0e10cSrcweir         pages. If not, it's value is <0>.
493*cdf0e10cSrcweir 
494*cdf0e10cSrcweir         @return boolean - indicating, that given preview position lays inside
495*cdf0e10cSrcweir         a shown document preview page, not an empty page.
496*cdf0e10cSrcweir     */
497*cdf0e10cSrcweir     bool IsPrevwPosInDocPrevwPage( const Point  _aPrevwPos,
498*cdf0e10cSrcweir                                    Point&       _orDocPos,
499*cdf0e10cSrcweir                                    bool&        _obPosInEmptyPage,
500*cdf0e10cSrcweir                                    sal_uInt16&  _onPageNum ) const;
501*cdf0e10cSrcweir 
502*cdf0e10cSrcweir     inline bool DoesPreviewLayoutRowsFitIntoWindow() const
503*cdf0e10cSrcweir     {
504*cdf0e10cSrcweir         return mbDoesLayoutRowsFitIntoWindow;
505*cdf0e10cSrcweir     }
506*cdf0e10cSrcweir 
507*cdf0e10cSrcweir     inline bool DoesPreviewLayoutColsFitIntoWindow() const
508*cdf0e10cSrcweir     {
509*cdf0e10cSrcweir         return mbDoesLayoutColsFitIntoWindow;
510*cdf0e10cSrcweir     }
511*cdf0e10cSrcweir 
512*cdf0e10cSrcweir     inline bool PreviewLayoutValid() const
513*cdf0e10cSrcweir     {
514*cdf0e10cSrcweir         return mbLayoutInfoValid && mbLayoutSizesValid && mbPaintInfoValid;
515*cdf0e10cSrcweir     }
516*cdf0e10cSrcweir 
517*cdf0e10cSrcweir     /** determine preview window page scroll amount
518*cdf0e10cSrcweir 
519*cdf0e10cSrcweir         OD 17.12.2002 #103492#
520*cdf0e10cSrcweir 
521*cdf0e10cSrcweir         @author OD
522*cdf0e10cSrcweir 
523*cdf0e10cSrcweir         @param _nWinPagesToScroll
524*cdf0e10cSrcweir         input parameter - number of preview window pages the scroll amount has
525*cdf0e10cSrcweir         to be calculated for. Negative values for preview window page up
526*cdf0e10cSrcweir         scrolling, positive values for preview window page down scrolling.
527*cdf0e10cSrcweir 
528*cdf0e10cSrcweir         @return scroll amount in SwTwips
529*cdf0e10cSrcweir     */
530*cdf0e10cSrcweir     SwTwips GetWinPagesScrollAmount( const sal_Int16 _nWinPagesToScroll ) const;
531*cdf0e10cSrcweir 
532*cdf0e10cSrcweir     /** determine row the page with the given number is in
533*cdf0e10cSrcweir 
534*cdf0e10cSrcweir         OD 17.01.2003 #103492#
535*cdf0e10cSrcweir 
536*cdf0e10cSrcweir         @author OD
537*cdf0e10cSrcweir 
538*cdf0e10cSrcweir         @param _nPageNum
539*cdf0e10cSrcweir         input parameter - physical page number of page, for which the row in
540*cdf0e10cSrcweir         preview layout has to be calculated.
541*cdf0e10cSrcweir 
542*cdf0e10cSrcweir         @return number of row the page with the given physical page number is in
543*cdf0e10cSrcweir     */
544*cdf0e10cSrcweir     sal_uInt16 GetRowOfPage( sal_uInt16 _nPageNum ) const;
545*cdf0e10cSrcweir 
546*cdf0e10cSrcweir     /** determine column the page with the given number is in
547*cdf0e10cSrcweir 
548*cdf0e10cSrcweir         OD 17.01.2003 #103492#
549*cdf0e10cSrcweir 
550*cdf0e10cSrcweir         @author OD
551*cdf0e10cSrcweir 
552*cdf0e10cSrcweir         @param _nPageNum
553*cdf0e10cSrcweir         input parameter - physical page number of page, for which the column in
554*cdf0e10cSrcweir         preview layout has to be calculated.
555*cdf0e10cSrcweir 
556*cdf0e10cSrcweir         @return number of column the page with the given physical page number is in
557*cdf0e10cSrcweir     */
558*cdf0e10cSrcweir     sal_uInt16 GetColOfPage( sal_uInt16 _nPageNum ) const;
559*cdf0e10cSrcweir 
560*cdf0e10cSrcweir     // OD 18.12.2002 #103492#
561*cdf0e10cSrcweir     Size GetPrevwDocSize() const;
562*cdf0e10cSrcweir 
563*cdf0e10cSrcweir     /** get size of a preview page by its physical page number
564*cdf0e10cSrcweir 
565*cdf0e10cSrcweir         OD 15.01.2003 #103492#
566*cdf0e10cSrcweir 
567*cdf0e10cSrcweir         @author OD
568*cdf0e10cSrcweir 
569*cdf0e10cSrcweir         @param _nPageNum
570*cdf0e10cSrcweir         input parameter - pysical page number of preview page, for which the
571*cdf0e10cSrcweir         page size has to be returned.
572*cdf0e10cSrcweir 
573*cdf0e10cSrcweir         @return an object of class <Size>
574*cdf0e10cSrcweir     */
575*cdf0e10cSrcweir     Size GetPrevwPageSizeByPageNum( sal_uInt16 _nPageNum ) const;
576*cdf0e10cSrcweir 
577*cdf0e10cSrcweir     /** get virtual page number by its physical page number
578*cdf0e10cSrcweir 
579*cdf0e10cSrcweir         OD 21.03.2003 #108282#
580*cdf0e10cSrcweir 
581*cdf0e10cSrcweir         @author OD
582*cdf0e10cSrcweir 
583*cdf0e10cSrcweir         @param _nPageNum
584*cdf0e10cSrcweir         input parameter - pysical page number of preview page, for which the
585*cdf0e10cSrcweir         virtual page number has to be determined.
586*cdf0e10cSrcweir 
587*cdf0e10cSrcweir         @return virtual page number of page given by its physical page number,
588*cdf0e10cSrcweir         if the page is in the current preview pages vector, otherwise 0.
589*cdf0e10cSrcweir     */
590*cdf0e10cSrcweir     sal_uInt16 GetVirtPageNumByPageNum( sal_uInt16 _nPageNum ) const;
591*cdf0e10cSrcweir 
592*cdf0e10cSrcweir     /** enable/disable book preview
593*cdf0e10cSrcweir 
594*cdf0e10cSrcweir         OD 2004-03-04 #i18143#
595*cdf0e10cSrcweir 
596*cdf0e10cSrcweir         @author OD
597*cdf0e10cSrcweir     */
598*cdf0e10cSrcweir     bool SetBookPreviewMode( const bool  _bEnableBookPreview,
599*cdf0e10cSrcweir                              sal_uInt16& _onStartPageNum,
600*cdf0e10cSrcweir                              Rectangle&  _orDocPreviewPaintRect );
601*cdf0e10cSrcweir 
602*cdf0e10cSrcweir     /** Convert relative to absolute page numbers (see PrintEmptyPages)
603*cdf0e10cSrcweir 
604*cdf0e10cSrcweir         @author FME
605*cdf0e10cSrcweir     */
606*cdf0e10cSrcweir     sal_uInt16 ConvertRelativeToAbsolutePageNum( sal_uInt16 _nRelPageNum ) const;
607*cdf0e10cSrcweir 
608*cdf0e10cSrcweir     /** Convert absolute to relative page numbers (see PrintEmptyPages)
609*cdf0e10cSrcweir 
610*cdf0e10cSrcweir         @author FME
611*cdf0e10cSrcweir     */
612*cdf0e10cSrcweir     sal_uInt16 ConvertAbsoluteToRelativePageNum( sal_uInt16 _nAbsPageNum ) const;
613*cdf0e10cSrcweir 
614*cdf0e10cSrcweir     /** get the number of preview pages
615*cdf0e10cSrcweir 
616*cdf0e10cSrcweir         @author FME
617*cdf0e10cSrcweir     */
618*cdf0e10cSrcweir     sal_uInt16 GetNumberOfPreviewPages() { return sal::static_int_cast< sal_uInt16 >(maPrevwPages.size()); }
619*cdf0e10cSrcweir };
620*cdf0e10cSrcweir 
621*cdf0e10cSrcweir #endif // _PAGEPREVIEWLAYOUT_HXX
622