1*01aa44aaSAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*01aa44aaSAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*01aa44aaSAndrew Rist * or more contributor license agreements. See the NOTICE file 5*01aa44aaSAndrew Rist * distributed with this work for additional information 6*01aa44aaSAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*01aa44aaSAndrew Rist * to you under the Apache License, Version 2.0 (the 8*01aa44aaSAndrew Rist * "License"); you may not use this file except in compliance 9*01aa44aaSAndrew Rist * with the License. You may obtain a copy of the License at 10cdf0e10cSrcweir * 11*01aa44aaSAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12cdf0e10cSrcweir * 13*01aa44aaSAndrew Rist * Unless required by applicable law or agreed to in writing, 14*01aa44aaSAndrew Rist * software distributed under the License is distributed on an 15*01aa44aaSAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*01aa44aaSAndrew Rist * KIND, either express or implied. See the License for the 17*01aa44aaSAndrew Rist * specific language governing permissions and limitations 18*01aa44aaSAndrew Rist * under the License. 19cdf0e10cSrcweir * 20*01aa44aaSAndrew Rist *************************************************************/ 21*01aa44aaSAndrew Rist 22*01aa44aaSAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir #ifndef _SCRWIN_HXX 25cdf0e10cSrcweir #define _SCRWIN_HXX 26cdf0e10cSrcweir 27cdf0e10cSrcweir #include "svtools/svtdllapi.h" 28cdf0e10cSrcweir 29cdf0e10cSrcweir #ifndef _SCRBAR_HXX //autogen 30cdf0e10cSrcweir #include <vcl/scrbar.hxx> 31cdf0e10cSrcweir #endif 32cdf0e10cSrcweir 33cdf0e10cSrcweir class DataChangedEvent; 34cdf0e10cSrcweir 35cdf0e10cSrcweir // ------------------------- 36cdf0e10cSrcweir // - ScrollableWindow-Type - 37cdf0e10cSrcweir // ------------------------- 38cdf0e10cSrcweir 39cdf0e10cSrcweir typedef sal_uInt16 ScrollableWindowFlags; 40cdf0e10cSrcweir 41cdf0e10cSrcweir #define SCRWIN_THUMBDRAGGING 1 42cdf0e10cSrcweir #define SCRWIN_VCENTER 2 43cdf0e10cSrcweir #define SCRWIN_HCENTER 4 44cdf0e10cSrcweir #define SCRWIN_DEFAULT (SCRWIN_THUMBDRAGGING | SCRWIN_VCENTER | SCRWIN_HCENTER) 45cdf0e10cSrcweir 46cdf0e10cSrcweir // -------------------- 47cdf0e10cSrcweir // - ScrollableWindow - 48cdf0e10cSrcweir // -------------------- 49cdf0e10cSrcweir 50cdf0e10cSrcweir class SVT_DLLPUBLIC ScrollableWindow: public Window 51cdf0e10cSrcweir { 52cdf0e10cSrcweir private: 53cdf0e10cSrcweir Point aPixOffset; // offset to virtual window (pixel) 54cdf0e10cSrcweir Size aTotPixSz; // total size of virtual window (pixel) 55cdf0e10cSrcweir long nLinePixH; // size of a line/column (pixel) 56cdf0e10cSrcweir long nColumnPixW; 57cdf0e10cSrcweir 58cdf0e10cSrcweir ScrollBar aVScroll; // the scrollbars 59cdf0e10cSrcweir ScrollBar aHScroll; 60cdf0e10cSrcweir ScrollBarBox aCornerWin; // window in the bottom right corner 61cdf0e10cSrcweir sal_Bool bScrolling:1, // user controlled scrolling 62cdf0e10cSrcweir bHandleDragging:1, // scroll window while dragging 63cdf0e10cSrcweir bHCenter:1, 64cdf0e10cSrcweir bVCenter:1; 65cdf0e10cSrcweir 66cdf0e10cSrcweir #ifdef _SVT_SCRWIN_CXX 67cdf0e10cSrcweir SVT_DLLPRIVATE void ImpInitialize( ScrollableWindowFlags nFlags ); 68cdf0e10cSrcweir DECL_DLLPRIVATE_LINK( ScrollHdl, ScrollBar * ); 69cdf0e10cSrcweir DECL_DLLPRIVATE_LINK( EndScrollHdl, ScrollBar * ); 70cdf0e10cSrcweir #endif 71cdf0e10cSrcweir 72cdf0e10cSrcweir public: 73cdf0e10cSrcweir ScrollableWindow( Window* pParent, WinBits nBits = 0, 74cdf0e10cSrcweir ScrollableWindowFlags = SCRWIN_DEFAULT ); 75cdf0e10cSrcweir ScrollableWindow( Window* pParent, const ResId& rId, 76cdf0e10cSrcweir ScrollableWindowFlags = SCRWIN_DEFAULT ); 77cdf0e10cSrcweir 78cdf0e10cSrcweir virtual void Resize(); 79cdf0e10cSrcweir virtual void Command( const CommandEvent& rCEvt ); 80cdf0e10cSrcweir virtual void DataChanged( const DataChangedEvent& rDEvt ); 81cdf0e10cSrcweir 82cdf0e10cSrcweir virtual void StartScroll(); 83cdf0e10cSrcweir virtual void EndScroll( long nDeltaX, long nDeltaY ); 84cdf0e10cSrcweir 85cdf0e10cSrcweir using OutputDevice::SetMapMode; 86cdf0e10cSrcweir virtual void SetMapMode( const MapMode& rNewMapMode ); 87cdf0e10cSrcweir virtual MapMode GetMapMode() const; 88cdf0e10cSrcweir 89cdf0e10cSrcweir void SetTotalSize( const Size& rNewSize ); GetTotalSize()90cdf0e10cSrcweir Size GetTotalSize() { return PixelToLogic( aTotPixSz ); } 91cdf0e10cSrcweir 92cdf0e10cSrcweir void SetVisibleSize( const Size& rNewSize ); 93cdf0e10cSrcweir sal_Bool MakeVisible( const Rectangle& rTarget, sal_Bool bSloppy = sal_False ); 94cdf0e10cSrcweir Rectangle GetVisibleArea() const; 95cdf0e10cSrcweir 96cdf0e10cSrcweir void SetLineSize( sal_uLong nHorz, sal_uLong nVert ); 97cdf0e10cSrcweir using Window::Scroll; 98cdf0e10cSrcweir virtual void Scroll( long nDeltaX, long nDeltaY, sal_uInt16 nFlags = 0 ); 99cdf0e10cSrcweir void ScrollLines( long nLinesX, long nLinesY ); 100cdf0e10cSrcweir void ScrollPages( long nPagesX, sal_uLong nOverlapX, 101cdf0e10cSrcweir long nPagesY, sal_uLong nOverlapY ); 102cdf0e10cSrcweir 103cdf0e10cSrcweir private: 104cdf0e10cSrcweir SVT_DLLPRIVATE Size GetOutputSizePixel() const; 105cdf0e10cSrcweir SVT_DLLPRIVATE Size GetOutputSize() const; 106cdf0e10cSrcweir }; 107cdf0e10cSrcweir 108cdf0e10cSrcweir #endif 109