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