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