1 /************************************************************************* 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright 2000, 2010 Oracle and/or its affiliates. 6 * 7 * OpenOffice.org - a multi-platform office productivity suite 8 * 9 * This file is part of OpenOffice.org. 10 * 11 * OpenOffice.org is free software: you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License version 3 13 * only, as published by the Free Software Foundation. 14 * 15 * OpenOffice.org is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU Lesser General Public License version 3 for more details 19 * (a copy is included in the LICENSE file that accompanied this code). 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 * version 3 along with OpenOffice.org. If not, see 23 * <http://www.openoffice.org/license.html> 24 * for a copy of the LGPLv3 License. 25 * 26 ************************************************************************/ 27 28 #ifndef _SCRWIN_HXX 29 #define _SCRWIN_HXX 30 31 #include "svtools/svtdllapi.h" 32 33 #ifndef _SCRBAR_HXX //autogen 34 #include <vcl/scrbar.hxx> 35 #endif 36 37 class DataChangedEvent; 38 39 // ------------------------- 40 // - ScrollableWindow-Type - 41 // ------------------------- 42 43 typedef sal_uInt16 ScrollableWindowFlags; 44 45 #define SCRWIN_THUMBDRAGGING 1 46 #define SCRWIN_VCENTER 2 47 #define SCRWIN_HCENTER 4 48 #define SCRWIN_DEFAULT (SCRWIN_THUMBDRAGGING | SCRWIN_VCENTER | SCRWIN_HCENTER) 49 50 // -------------------- 51 // - ScrollableWindow - 52 // -------------------- 53 54 class SVT_DLLPUBLIC ScrollableWindow: public Window 55 { 56 private: 57 Point aPixOffset; // offset to virtual window (pixel) 58 Size aTotPixSz; // total size of virtual window (pixel) 59 long nLinePixH; // size of a line/column (pixel) 60 long nColumnPixW; 61 62 ScrollBar aVScroll; // the scrollbars 63 ScrollBar aHScroll; 64 ScrollBarBox aCornerWin; // window in the bottom right corner 65 sal_Bool bScrolling:1, // user controlled scrolling 66 bHandleDragging:1, // scroll window while dragging 67 bHCenter:1, 68 bVCenter:1; 69 70 #ifdef _SVT_SCRWIN_CXX 71 SVT_DLLPRIVATE void ImpInitialize( ScrollableWindowFlags nFlags ); 72 DECL_DLLPRIVATE_LINK( ScrollHdl, ScrollBar * ); 73 DECL_DLLPRIVATE_LINK( EndScrollHdl, ScrollBar * ); 74 #endif 75 76 public: 77 ScrollableWindow( Window* pParent, WinBits nBits = 0, 78 ScrollableWindowFlags = SCRWIN_DEFAULT ); 79 ScrollableWindow( Window* pParent, const ResId& rId, 80 ScrollableWindowFlags = SCRWIN_DEFAULT ); 81 82 virtual void Resize(); 83 virtual void Command( const CommandEvent& rCEvt ); 84 virtual void DataChanged( const DataChangedEvent& rDEvt ); 85 86 virtual void StartScroll(); 87 virtual void EndScroll( long nDeltaX, long nDeltaY ); 88 89 using OutputDevice::SetMapMode; 90 virtual void SetMapMode( const MapMode& rNewMapMode ); 91 virtual MapMode GetMapMode() const; 92 93 void SetTotalSize( const Size& rNewSize ); 94 Size GetTotalSize() { return PixelToLogic( aTotPixSz ); } 95 96 void SetVisibleSize( const Size& rNewSize ); 97 sal_Bool MakeVisible( const Rectangle& rTarget, sal_Bool bSloppy = sal_False ); 98 Rectangle GetVisibleArea() const; 99 100 void SetLineSize( sal_uLong nHorz, sal_uLong nVert ); 101 using Window::Scroll; 102 virtual void Scroll( long nDeltaX, long nDeltaY, sal_uInt16 nFlags = 0 ); 103 void ScrollLines( long nLinesX, long nLinesY ); 104 void ScrollPages( long nPagesX, sal_uLong nOverlapX, 105 long nPagesY, sal_uLong nOverlapY ); 106 107 private: 108 SVT_DLLPRIVATE Size GetOutputSizePixel() const; 109 SVT_DLLPRIVATE Size GetOutputSize() const; 110 }; 111 112 #endif 113