11d2dbeb0SAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 31d2dbeb0SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 41d2dbeb0SAndrew Rist * or more contributor license agreements. See the NOTICE file 51d2dbeb0SAndrew Rist * distributed with this work for additional information 61d2dbeb0SAndrew Rist * regarding copyright ownership. The ASF licenses this file 71d2dbeb0SAndrew Rist * to you under the Apache License, Version 2.0 (the 81d2dbeb0SAndrew Rist * "License"); you may not use this file except in compliance 91d2dbeb0SAndrew Rist * with the License. You may obtain a copy of the License at 10cdf0e10cSrcweir * 111d2dbeb0SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12cdf0e10cSrcweir * 131d2dbeb0SAndrew Rist * Unless required by applicable law or agreed to in writing, 141d2dbeb0SAndrew Rist * software distributed under the License is distributed on an 151d2dbeb0SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 161d2dbeb0SAndrew Rist * KIND, either express or implied. See the License for the 171d2dbeb0SAndrew Rist * specific language governing permissions and limitations 181d2dbeb0SAndrew Rist * under the License. 19cdf0e10cSrcweir * 201d2dbeb0SAndrew Rist *************************************************************/ 211d2dbeb0SAndrew Rist 221d2dbeb0SAndrew Rist 23cdf0e10cSrcweir #ifndef _SWPVIEW_HXX 24cdf0e10cSrcweir #define _SWPVIEW_HXX 25cdf0e10cSrcweir 26cdf0e10cSrcweir #include <tools/link.hxx> 27cdf0e10cSrcweir #include <vcl/window.hxx> 28cdf0e10cSrcweir #include <sfx2/viewfrm.hxx> 29cdf0e10cSrcweir #include <sfx2/viewfac.hxx> 30cdf0e10cSrcweir #include <sfx2/viewsh.hxx> 31cdf0e10cSrcweir #include <svx/zoomitem.hxx> 32cdf0e10cSrcweir #include "swdllapi.h" 33cdf0e10cSrcweir #include "shellid.hxx" 34cdf0e10cSrcweir 35cdf0e10cSrcweir class SwViewOption; 36cdf0e10cSrcweir class SwDocShell; 37cdf0e10cSrcweir class SwScrollbar; 38cdf0e10cSrcweir class ViewShell; 39cdf0e10cSrcweir class SwPagePreView; 40cdf0e10cSrcweir class ImageButton; 41cdf0e10cSrcweir class Button; 42cdf0e10cSrcweir class SwRect; 43cdf0e10cSrcweir class DataChangedEvent; 44cdf0e10cSrcweir class CommandEvent; 45cdf0e10cSrcweir class SvtAccessibilityOptions; 46cdf0e10cSrcweir // OD 12.12.2002 #103492# 47cdf0e10cSrcweir class SwPagePreviewLayout; 48cdf0e10cSrcweir 49cdf0e10cSrcweir // OD 24.03.2003 #108282# - delete member <mnVirtPage> and its accessor. 50cdf0e10cSrcweir class SwPagePreViewWin : public Window 51cdf0e10cSrcweir { 52cdf0e10cSrcweir ViewShell* mpViewShell; 53cdf0e10cSrcweir sal_uInt16 mnSttPage; 54cdf0e10cSrcweir sal_uInt8 mnRow, mnCol; 55cdf0e10cSrcweir Size maPxWinSize; 56cdf0e10cSrcweir Fraction maScale; 57cdf0e10cSrcweir SwPagePreView& mrView; 58cdf0e10cSrcweir // OD 02.12.2002 #103492# 59cdf0e10cSrcweir bool mbCalcScaleForPreviewLayout; 60cdf0e10cSrcweir Rectangle maPaintedPreviewDocRect; 61cdf0e10cSrcweir // OD 12.12.2002 #103492# 62cdf0e10cSrcweir SwPagePreviewLayout* mpPgPrevwLayout; 63cdf0e10cSrcweir 64cdf0e10cSrcweir void SetPagePreview( sal_uInt8 nRow, sal_uInt8 nCol ); 65cdf0e10cSrcweir 66cdf0e10cSrcweir using Window::Scroll; 67cdf0e10cSrcweir 68cdf0e10cSrcweir public: 69cdf0e10cSrcweir SwPagePreViewWin( Window* pParent, SwPagePreView& rView ); 70cdf0e10cSrcweir ~SwPagePreViewWin(); 71cdf0e10cSrcweir 72cdf0e10cSrcweir //Ruft ViewShell::Paint 73cdf0e10cSrcweir virtual void Paint( const Rectangle& rRect ); 74cdf0e10cSrcweir virtual void KeyInput( const KeyEvent & ); 75cdf0e10cSrcweir virtual void Command( const CommandEvent& rCEvt ); 76cdf0e10cSrcweir virtual void MouseButtonDown(const MouseEvent& rMEvt); 77cdf0e10cSrcweir virtual void DataChanged( const DataChangedEvent& ); 78cdf0e10cSrcweir 79cdf0e10cSrcweir void SetViewShell( ViewShell* pShell ); 80cdf0e10cSrcweir 81cdf0e10cSrcweir ViewShell* GetViewShell() const { return mpViewShell; } 82cdf0e10cSrcweir 83cdf0e10cSrcweir sal_uInt8 GetRow() const { return mnRow; } 84cdf0e10cSrcweir void SetRow( sal_uInt8 n ) { if( n ) mnRow = n; } 85cdf0e10cSrcweir 86cdf0e10cSrcweir sal_uInt8 GetCol() const { return mnCol; } 87cdf0e10cSrcweir void SetCol( sal_uInt8 n ) { if( n ) mnCol = n; } 88cdf0e10cSrcweir 89cdf0e10cSrcweir sal_uInt16 GetSttPage() const { return mnSttPage; } 90cdf0e10cSrcweir void SetSttPage( sal_uInt16 n ) { mnSttPage = n; } 91cdf0e10cSrcweir 92cdf0e10cSrcweir /** get selected page number of document preview 93cdf0e10cSrcweir 94cdf0e10cSrcweir OD 13.12.2002 #103492# 95cdf0e10cSrcweir 96cdf0e10cSrcweir @author OD 97cdf0e10cSrcweir 98cdf0e10cSrcweir @return selected page number 99cdf0e10cSrcweir */ 100cdf0e10cSrcweir sal_uInt16 SelectedPage() const; 101cdf0e10cSrcweir 102cdf0e10cSrcweir /** set selected page number in document preview 103cdf0e10cSrcweir 104cdf0e10cSrcweir OD 13.12.2002 #103492# 105cdf0e10cSrcweir 106cdf0e10cSrcweir @author OD 107cdf0e10cSrcweir 108cdf0e10cSrcweir @param _nSelectedPageNum 109cdf0e10cSrcweir input parameter - physical page number of page that will be the selected one. 110cdf0e10cSrcweir */ 111cdf0e10cSrcweir void SetSelectedPage( sal_uInt16 _nSelectedPageNum ); 112cdf0e10cSrcweir 113cdf0e10cSrcweir //JP 19.08.98: bei Einspaltigkeit gibt es keine 0. Seite! 114cdf0e10cSrcweir sal_uInt16 GetDefSttPage() const { return 1 == mnCol ? 1 : 0; } 115cdf0e10cSrcweir 116cdf0e10cSrcweir void CalcWish( sal_uInt8 nNewRow, sal_uInt8 nNewCol ); 117cdf0e10cSrcweir 118cdf0e10cSrcweir const Size& GetWinSize() const { return maPxWinSize; } 119cdf0e10cSrcweir void SetWinSize( const Size& rNewSize ); 120cdf0e10cSrcweir 121cdf0e10cSrcweir // OD 18.12.2002 #103492# - add <MV_SELPAGE>, <MV_SCROLL> 122cdf0e10cSrcweir enum MoveMode{ MV_CALC, MV_PAGE_UP, MV_PAGE_DOWN, MV_DOC_STT, MV_DOC_END, 123cdf0e10cSrcweir MV_SELPAGE, MV_SCROLL, MV_NEWWINSIZE }; 124cdf0e10cSrcweir int MovePage( int eMoveMode ); 125cdf0e10cSrcweir 126cdf0e10cSrcweir // erzeuge den String fuer die StatusLeiste 127cdf0e10cSrcweir void GetStatusStr( String& rStr, sal_uInt16 nPageCount ) const; 128cdf0e10cSrcweir 129cdf0e10cSrcweir void RepaintCoreRect( const SwRect& rRect ); 130cdf0e10cSrcweir 131cdf0e10cSrcweir /** method to adjust preview to a new zoom factor 132cdf0e10cSrcweir 133cdf0e10cSrcweir OD 02.12.2002 #103492# 134cdf0e10cSrcweir paint of preview is prepared for a new zoom factor 135cdf0e10cSrcweir OD 24.09.2003 #i19975# - zoom type has also been considered. 136cdf0e10cSrcweir Thus, add new parameter <_eZoomType> 137cdf0e10cSrcweir 138cdf0e10cSrcweir @author OD 139cdf0e10cSrcweir */ 140cdf0e10cSrcweir void AdjustPreviewToNewZoom( const sal_uInt16 _nZoomFactor, 141cdf0e10cSrcweir const SvxZoomType _eZoomType ); 142cdf0e10cSrcweir 143cdf0e10cSrcweir const Rectangle& GetPaintedPreviewDocRect() const 144cdf0e10cSrcweir { 145cdf0e10cSrcweir return maPaintedPreviewDocRect; 146cdf0e10cSrcweir } 147cdf0e10cSrcweir 148cdf0e10cSrcweir void Scroll(long nXMove, long nYMove, sal_uInt16 nFlags = 0); 149cdf0e10cSrcweir 150cdf0e10cSrcweir /** method to enable/disable book preview 151cdf0e10cSrcweir 152cdf0e10cSrcweir OD 2004-03-05 #i18143# 153cdf0e10cSrcweir 154cdf0e10cSrcweir @author OD 155cdf0e10cSrcweir 156cdf0e10cSrcweir @param _bBookPreview 157cdf0e10cSrcweir input parameter - boolean indicating, if book preview mode has to 158cdf0e10cSrcweir switch on <sal_True> or of <sal_False> 159cdf0e10cSrcweir 160cdf0e10cSrcweir @return boolean indicating, if book preview mode has changed. 161cdf0e10cSrcweir */ 162cdf0e10cSrcweir bool SetBookPreviewMode( const bool _bBookPreview ); 163cdf0e10cSrcweir 164cdf0e10cSrcweir virtual ::com::sun::star::uno::Reference< 165cdf0e10cSrcweir ::com::sun::star::accessibility::XAccessible> 166cdf0e10cSrcweir CreateAccessible(); 167*ca62e2c2SSteve Yin //IAccessibility2 Implementation 2009----- 168*ca62e2c2SSteve Yin virtual void SwitchView(); 169*ca62e2c2SSteve Yin //-----IAccessibility2 Implementation 2009 170cdf0e10cSrcweir }; 171cdf0e10cSrcweir 172cdf0e10cSrcweir 173cdf0e10cSrcweir /*-------------------------------------------------------------------- 174cdf0e10cSrcweir Beschreibung: Sicht auf ein Dokument 175cdf0e10cSrcweir --------------------------------------------------------------------*/ 176cdf0e10cSrcweir 177cdf0e10cSrcweir class SW_DLLPUBLIC SwPagePreView: public SfxViewShell 178cdf0e10cSrcweir { 179cdf0e10cSrcweir // ViewWindow und Henkel zur Core 180cdf0e10cSrcweir // aktuelle Dispatcher-Shell 181*ca62e2c2SSteve Yin SwPagePreViewWin* pViewWin;//IAccessibility2 Implementation 2009 182cdf0e10cSrcweir //viewdata of the previous SwView and the new crsrposition 183cdf0e10cSrcweir String sSwViewData, 184cdf0e10cSrcweir //and the new cursor position if the user double click in the PagePreView 185cdf0e10cSrcweir sNewCrsrPos; 186cdf0e10cSrcweir // to support keyboard the number of the page to go to can be set too 187cdf0e10cSrcweir sal_uInt16 nNewPage; 188cdf0e10cSrcweir // Sichtbarer Bereich 189cdf0e10cSrcweir String sPageStr; 190cdf0e10cSrcweir Size aDocSz; 191cdf0e10cSrcweir Rectangle aVisArea; 192cdf0e10cSrcweir 193cdf0e10cSrcweir // MDI Bedienelemente 194cdf0e10cSrcweir SwScrollbar *pHScrollbar; 195cdf0e10cSrcweir SwScrollbar *pVScrollbar; 196cdf0e10cSrcweir ImageButton *pPageUpBtn, 197cdf0e10cSrcweir *pPageDownBtn; 198cdf0e10cSrcweir // Dummy-Window zum F�llen der rechten unteren Ecke, wenn beide Scrollbars 199cdf0e10cSrcweir // aktiv sind 200cdf0e10cSrcweir Window *pScrollFill; 201cdf0e10cSrcweir 202cdf0e10cSrcweir sal_uInt16 mnPageCount; 203cdf0e10cSrcweir sal_Bool bNormalPrint; 204cdf0e10cSrcweir 205cdf0e10cSrcweir // OD 09.01.2003 #106334# 206cdf0e10cSrcweir // new members to reset design mode at draw view for form shell on switching 207cdf0e10cSrcweir // back from writer page preview to normal view. 208cdf0e10cSrcweir sal_Bool mbResetFormDesignMode:1; 209cdf0e10cSrcweir sal_Bool mbFormDesignModeToReset:1; 210cdf0e10cSrcweir 211cdf0e10cSrcweir SW_DLLPRIVATE void Init(const SwViewOption* = 0); 212cdf0e10cSrcweir SW_DLLPRIVATE Point AlignToPixel(const Point& rPt) const; 213cdf0e10cSrcweir 214cdf0e10cSrcweir SW_DLLPRIVATE int _CreateScrollbar( sal_Bool bHori ); 215cdf0e10cSrcweir SW_DLLPRIVATE DECL_LINK( ScrollHdl, SwScrollbar * ); 216cdf0e10cSrcweir SW_DLLPRIVATE DECL_LINK( EndScrollHdl, SwScrollbar * ); 217cdf0e10cSrcweir SW_DLLPRIVATE DECL_LINK( BtnPage, Button * ); 218cdf0e10cSrcweir SW_DLLPRIVATE int ChgPage( int eMvMode, int bUpdateScrollbar = sal_True ); 219cdf0e10cSrcweir 220cdf0e10cSrcweir 221cdf0e10cSrcweir SW_DLLPRIVATE virtual SfxPrinter* GetPrinter( sal_Bool bCreate = sal_False ); 222cdf0e10cSrcweir SW_DLLPRIVATE virtual sal_uInt16 SetPrinter( SfxPrinter *pNewPrinter, sal_uInt16 nDiffFlags = SFX_PRINTER_ALL, bool bIsAPI=false ); 223cdf0e10cSrcweir SW_DLLPRIVATE virtual SfxTabPage* CreatePrintOptionsPage( Window *pParent, 224cdf0e10cSrcweir const SfxItemSet &rOptions ); 225cdf0e10cSrcweir 226cdf0e10cSrcweir SW_DLLPRIVATE void CalcAndSetBorderPixel( SvBorder &rToFill, sal_Bool bInner ); 227cdf0e10cSrcweir 228cdf0e10cSrcweir /** help method to execute SfxRequest FN_PAGE_UP and FN_PAGE_DOWN 229cdf0e10cSrcweir 230cdf0e10cSrcweir OD 04.03.2003 #107369# 231cdf0e10cSrcweir 232cdf0e10cSrcweir @param _bPgUp 233cdf0e10cSrcweir input parameter - boolean that indicates, if FN_PAGE_UP or FN_PAGE_DOWN 234cdf0e10cSrcweir has to be executed. 235cdf0e10cSrcweir 236cdf0e10cSrcweir @param _pReq 237cdf0e10cSrcweir optional input parameter - pointer to the <SfxRequest> instance, if existing. 238cdf0e10cSrcweir 239cdf0e10cSrcweir @author OD 240cdf0e10cSrcweir */ 241cdf0e10cSrcweir SW_DLLPRIVATE void _ExecPgUpAndPgDown( const bool _bPgUp, 242cdf0e10cSrcweir SfxRequest* _pReq = 0 ); 243cdf0e10cSrcweir 244cdf0e10cSrcweir protected: 245cdf0e10cSrcweir virtual void InnerResizePixel( const Point &rOfs, const Size &rSize ); 246cdf0e10cSrcweir virtual void OuterResizePixel( const Point &rOfs, const Size &rSize ); 247cdf0e10cSrcweir virtual Size GetOptimalSizePixel() const; 248cdf0e10cSrcweir 249cdf0e10cSrcweir void SetZoom(SvxZoomType eSet, sal_uInt16 nFactor); 250cdf0e10cSrcweir 251cdf0e10cSrcweir public: 252cdf0e10cSrcweir SFX_DECL_VIEWFACTORY(SwPagePreView); 253cdf0e10cSrcweir SFX_DECL_INTERFACE(SW_PAGEPREVIEW) 254cdf0e10cSrcweir TYPEINFO(); 255cdf0e10cSrcweir 256cdf0e10cSrcweir inline Window* GetFrameWindow() const { return &(GetViewFrame())->GetWindow(); } 257*ca62e2c2SSteve Yin inline ViewShell* GetViewShell() const { return pViewWin->GetViewShell(); } 258cdf0e10cSrcweir inline const Rectangle& GetVisArea() const { return aVisArea; } 259*ca62e2c2SSteve Yin inline void GrabFocusViewWin() { pViewWin->GrabFocus(); } 260cdf0e10cSrcweir inline void RepaintCoreRect( const SwRect& rRect ) 261*ca62e2c2SSteve Yin { pViewWin->RepaintCoreRect( rRect ); } 262cdf0e10cSrcweir 263cdf0e10cSrcweir void DocSzChgd(const Size& rNewSize); 264cdf0e10cSrcweir const Size& GetDocSz() const { return aDocSz; } 265cdf0e10cSrcweir 266cdf0e10cSrcweir virtual void SetVisArea( const Rectangle&, sal_Bool bUpdateScrollbar = sal_True); 267cdf0e10cSrcweir 268cdf0e10cSrcweir inline void AdjustEditWin(); 269cdf0e10cSrcweir 270cdf0e10cSrcweir void ScrollViewSzChg(); 271cdf0e10cSrcweir void ScrollDocSzChg(); 272cdf0e10cSrcweir void ShowHScrollbar(sal_Bool bShow); 273cdf0e10cSrcweir 274cdf0e10cSrcweir void ShowVScrollbar(sal_Bool bShow); 275cdf0e10cSrcweir 276cdf0e10cSrcweir sal_uInt16 GetPageCount() const { return mnPageCount; } 277cdf0e10cSrcweir 278cdf0e10cSrcweir sal_Bool HandleWheelCommands( const CommandEvent& ); 279cdf0e10cSrcweir 280cdf0e10cSrcweir const String& GetPrevSwViewData() const { return sSwViewData; } 281cdf0e10cSrcweir void SetNewCrsrPos( const String& rStr ) { sNewCrsrPos = rStr; } 282cdf0e10cSrcweir const String& GetNewCrsrPos() const { return sNewCrsrPos; } 283cdf0e10cSrcweir 284cdf0e10cSrcweir sal_uInt16 GetNewPage() const {return nNewPage;} 285cdf0e10cSrcweir void SetNewPage(sal_uInt16 nSet) {nNewPage = nSet;} 286cdf0e10cSrcweir 287cdf0e10cSrcweir // Handler 288cdf0e10cSrcweir void Execute(SfxRequest&); 289cdf0e10cSrcweir void GetState(SfxItemSet&); 290cdf0e10cSrcweir void StateUndo(SfxItemSet&); 291cdf0e10cSrcweir 292cdf0e10cSrcweir SwDocShell* GetDocShell(); 293cdf0e10cSrcweir 294cdf0e10cSrcweir //apply Accessiblity options 295cdf0e10cSrcweir void ApplyAccessiblityOptions(SvtAccessibilityOptions& rAccessibilityOptions); 296cdf0e10cSrcweir 297cdf0e10cSrcweir // OD 09.01.2003 #106334# - inline method to request values of new members 298cdf0e10cSrcweir // <mbResetFormDesignMode> and <mbFormDesignModeToReset> 299cdf0e10cSrcweir inline sal_Bool ResetFormDesignMode() const 300cdf0e10cSrcweir { 301cdf0e10cSrcweir return mbResetFormDesignMode; 302cdf0e10cSrcweir } 303cdf0e10cSrcweir 304cdf0e10cSrcweir inline sal_Bool FormDesignModeToReset() const 305cdf0e10cSrcweir { 306cdf0e10cSrcweir return mbFormDesignModeToReset; 307cdf0e10cSrcweir } 308cdf0e10cSrcweir 309cdf0e10cSrcweir /** adjust position of vertical scrollbar 310cdf0e10cSrcweir 311cdf0e10cSrcweir OD 19.02.2003 #107369 312cdf0e10cSrcweir Currently used, if the complete preview layout rows fit into to the given 313cdf0e10cSrcweir window, if a new page is selected and this page is visible. 314cdf0e10cSrcweir 315cdf0e10cSrcweir @author OD 316cdf0e10cSrcweir 317cdf0e10cSrcweir @param _nNewThumbPos 318cdf0e10cSrcweir input parameter - new position, which will be assigned to the vertical 319cdf0e10cSrcweir scrollbar. 320cdf0e10cSrcweir */ 321cdf0e10cSrcweir void SetVScrollbarThumbPos( const sal_uInt16 _nNewThumbPos ); 322cdf0e10cSrcweir 323cdf0e10cSrcweir SwPagePreView( SfxViewFrame* pFrame, SfxViewShell* ); 324cdf0e10cSrcweir ~SwPagePreView(); 325cdf0e10cSrcweir }; 326cdf0e10cSrcweir 327cdf0e10cSrcweir // ----------------- inline Methoden ---------------------- 328cdf0e10cSrcweir 329cdf0e10cSrcweir 330cdf0e10cSrcweir inline void SwPagePreView::AdjustEditWin() 331cdf0e10cSrcweir { 332cdf0e10cSrcweir OuterResizePixel( Point(), GetFrameWindow()->GetOutputSizePixel() ); 333cdf0e10cSrcweir } 334cdf0e10cSrcweir 335cdf0e10cSrcweir #endif 336